Home  >  Q&A  >  body text

网页爬虫 - 淘宝python爬虫

在爬天猫数据的时候出现Redirect Limits的报错,猜测是302一直跳转的问题?

然后试着模拟了cookie,发现有三个值是必须要有的

cookie2=; t=; _tb_token_=

但是苦于这三个值不知道如何获取,所以部署到线上就出错了,有高手知道如何解决吗?谢谢

PHP中文网PHP中文网2721 days ago350

reply all(1)I'll reply

  • 怪我咯

    怪我咯2017-04-17 17:49:26

    First pull up the homepage of Tianbao to save the cookie, and then visit the specific page

    import requests
    session = requests.Session()
    session.headers = {'user-agent': '填写你的浏览器值'}
    session.get('店铺首页')
    
    r = session.get('具体要访问的页面')
    printr.text

    reply
    0
  • Cancelreply