【发布时间】:2016-02-09 18:17:09
【问题描述】:
我正在学习网络抓取,我一直在尝试编写一个从Steam's website 提取信息的程序作为练习。
我想编写一个程序,只访问每个最畅销游戏的页面并提取一些内容,但是当我的程序尝试访问 M 级游戏时,它只是被重定向到年龄检查页面。
我的程序看起来像这样:
front_page = urlopen('http://store.steampowered.com/').read()
bs = BeautifulSoup(front_page, 'html.parser')
top_sellers = bs.select('#tab_topsellers_content a.tab_item_overlay')
for item in top_sellers:
game_page = urlopen(item.get('href'))
bs = BeautifulSoup(game_page.read(), 'html.parser')
#Now I'm on the age check page :(
我不知道如何通过年龄检查,我尝试通过向其发送 POST 请求来填写年龄检查,如下所示:
post_params = urlencode({'ageDay': '1', 'ageMonth': 'January', 'ageYear': '1988', 'snr': '1_agecheck_agecheck__age-gate'}).encode('utf-8')
page = urlopen(agecheckurl, post_params)
但它不起作用,我还在年龄检查页面上。任何人都可以在这里帮助我,我该如何克服它?
【问题讨论】:
标签: python python-3.x web-scraping beautifulsoup python-3.5