import time import requests from bs4 import BeautifulSoup headers = { 'User-Agent' : 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.146 Safari/537.36' } def get_info ( url ) : req = requests.get ( url = url, headers = headers ) soup = BeautifulSoup ( req.text, 'lxml' ) ranks = soup.select ( '.pc_temp_num' ) titles = soup.select ( '.pc_temp_songlist > ul > li > a' ) times = soup.select ( '.pc_temp_time' ) for rank,title,time in zip ( ranks,titles,times ) : data = { 'rank' : rank.get_text () .strip () , 'title' : title.get_text () .split ( '-' ) [ 1