Giter VIP home page Giter VIP logo

Comments (5)

zhishui1 avatar zhishui1 commented on July 22, 2024 1

程序虽然运行成功,但是没有结果。
debug后,发现在正则匹配的时候没有返回结果。
items = re.findall(pattern, html) items 为空

看了下,猫眼的首页加了个验证码验证,所以没有获取到正确的网页源代码

from maoyan.

xiaomx32 avatar xiaomx32 commented on July 22, 2024

进入猫眼首页,手动验证一下,代码就可以运行了

from maoyan.

JacobHuangCHINA avatar JacobHuangCHINA commented on July 22, 2024

可以先手动登录猫眼网站,然后在浏览器获取自己的cookie,然后在get_one_page(url)函数中添加一个 cookie,然后在请求里添加cookie
cookies = {'cookie': '你自己的cookie'} response = requests.get(url, cookies=cookies, headers=headers)
这样就可以了,但是这样只获取了40个电影信息,没有获取到100个,具体什么原因还没有找到,找到后再更新一下

from maoyan.

JacobHuangCHINA avatar JacobHuangCHINA commented on July 22, 2024

可以先手动登录猫眼网站,然后在浏览器获取自己的cookie,然后在get_one_page(url)函数中添加一个 cookie,然后在请求里添加cookie
cookies = {'cookie': '你自己的cookie'} response = requests.get(url, cookies=cookies, headers=headers)
这样就可以了,但是这样只获取了40个电影信息,没有获取到100个,具体什么原因还没有找到,找到后再更新一下

Debug 后, 发现猫眼首页添加了反爬虫-验证拼图,所以后面的返回的是一个验证url,自然爬取不了,等学习到后面如何处理验证,再回来解答

from maoyan.

ddhhtt271 avatar ddhhtt271 commented on July 22, 2024

今天试了一下,爬是可以爬,但好像爬了一次以后要隔一段时间才能再爬

from maoyan.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.