Interest Ranked obtain information

Requests Import 
from lxml Import etree 
# crawling known before heat almost ten 
headers = { 'User-Agent' : 'Mozilla / 5.0 (Windows NT 10.0; Win64; x64) AppleWebKit / 537.36 (KHTML, like Gecko) Chrome / 70.0 Safari .3538.102 / 537.36 Edge / 18.18362 '} 
URL = "https://tophub.today/" 
Response = requests.get (URL, headers = headers) # get request to send 
html = etree.HTML (response.text) # Construction xpath an analysis target 
a = html.xpath ( ".// span [ @ class = 't'] / text ()") [50:60] # using regular expressions, crawling know almost top ten titles 
b = html.xpath ( ".// span [@ class = 'e'] / text ()") [50:60] # using regular expressions, crawling know almost top ten heat 
for i in range (0 , len (A)): 
    Print (. "ranking: {} - title: ------ heat {}: {}" format (i + 1, a [i], b [i])) # data visualization

  

Guess you like

Origin www.cnblogs.com/FFDXMM/p/12541667.html