wistbean / wistbean/learn_python3_spider
关于爬取豆瓣网第一步获取请求失败的原因(我认为的)及解决方法
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 22.1k
- Forks
- 3.9k
- PR merge metrics
- No merged PRs in 30d
Description
response = requests.get(url, headers=headers)将response对照改成上面的样子即可,原因:我认为应该是发送的user—Agent没有被正确收到导致url拒绝了我们的请求,加上这个可以确保收到.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the Python spider code that calls requests.get(url, headers=headers) and inspect how the headers and User-Agent are defined. Reproduce the failed request against Douban, then verify that the request succeeds with the intended User-Agent and that the scraper continues as expected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- web-dev
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100