wistbean / wistbean/learn_python3_spider

关于的二个豆瓣电影问题报错问题的解决方案

Open
#10 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
22.1k
Forks
3.9k
PR merge metrics
No merged PRs in 30d

Description

`
from fake_useragent import UserAgent

ua = UserAgent()
def request_douban(url):
try:
headers = {'User-Agent': ua.chrome}
response = requests.get(url,headers=headers)
`
加一个headers=headers请求头就行了,
加上加粗的部分,其他代码不变

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the request_douban(url) entry point and inspect the existing requests.get call in the affected spider example. Verify the request uses the User-Agent setup shown in the issue, then reproduce the Douban request to confirm the reported error is resolved.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
web-dev
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.