Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

怎麼使用代理 IP? #18

Open
jackylau28 opened this issue Feb 24, 2021 · 3 comments
Open

怎麼使用代理 IP? #18

jackylau28 opened this issue Feb 24, 2021 · 3 comments

Comments

@jackylau28
Copy link

怎麼使用代理 IP?

@baabaaox
Copy link
Owner

baabaaox commented Feb 25, 2021

@jackylau28

class ProxyMiddleware(object):
def process_request(self, request, spider):
# curl https://m.douban.com/book/subject/26628811/ -x http:https://127.0.0.1:8081
request.meta["proxy"] = "http:https://127.0.0.1:8081"

修改成你的代理地址

# DOWNLOADER_MIDDLEWARES = {
# 'douban.middlewares.DoubanDownloaderMiddleware': 543,
# }

在设置里面启用 douban.middlewares.ProxyMiddleware

@chengs2035
Copy link

这个代理的地址,要咋搭建呀?

@baabaaox
Copy link
Owner

@chengs2035 买代理 ip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants