The road of python crawler - first knowledge and simple example of headless browser

 

 

 

 

from selenium import webdriver
url='https://www.jianshu.com/p/a64529b4ccf3'
def get_info(url):
    include_title=[]
    driver=webdriver.PhantomJS()
    driver.get(url)
    driver.implicitly_wait(20)
    author=driver.find_element_by_xpath('/html/body/div[1]/div[1]/div[1]/div[1]/div/span/a').text
    print(author)
get_info(url)

 

 

 

 

 

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324683795&siteId=291194637