How to pass Age Verification with DOM

前端 未结 2 1177
天命终不由人
天命终不由人 2021-01-19 02:19

I\'m attempting to pull some image URLs from Steam store pages, such as: http://store.steampowered.com/app/35700/
http://store.steampowered.com/app/252490/

Her

2条回答
  •  天命终不由人
    2021-01-19 02:34

    You were looking for php answers, but I was trying to do the same thing in python and this was the most relevant question. Your php answer helped me out so maybe a python solution will help someone. My solution using python-requests in Python 2.7:

        import requests
    
        url = 'http://store.steampowered.com/app/252490/'
        cookie = {
                'birthtime' : '28801',
                'path' : '/',
                'domain' : 'store.steampowered.com'
                }
    
        r = requests.get(url, cookies=cookie)
        assert (r.status_code == 200 and r.text.find('Please enter your birth date to continue') < 0), ("Failed to retrieve page for {url}. Error={code}.".format(url=url, code=r.status_code))
    
        print r.text.encode('utf-8')
    

提交回复
热议问题