我使用Python来抓取this webpage。但是当你点击“上一个”按钮时,我就拿不下这些东西了。我想用硒来达到这个目的,但我没有成功地使它无头。在
通过下面的代码,我可以抓取匹配链接:
import urllib2
import re
site_url = 'http://us.soccerway.com'
national_league_div_sub_matches_url = 'http://us.soccerway.com/national/england/premier-league/20132014/regular-season/r21322/'
national_league_div_sub_matches_url_source = urllib2.urlopen(national_league_div_sub_matches_url).read()
match_links = re.findall('(/matches/[0-9][0-9][0-9][0-9]/.*?ICID.*?)">', national_league_div_sub_matches_url_source)
match_links = map(lambda x: ''.join([site_url, x]), match_links)
for x in match_links:
print x
当您在浏览器中单击
previous
时,javascript调用这个长的url
从服务器获取JSON数据,所以也要这样做。在现在你有
dict
在data
中,所以你必须找到你需要的东西。在可能每次点击broswer中的
previous
都会改变url
,所以如果你想得到更旧的数据,你也必须这样做。在相关问题 更多 >
编程相关推荐