Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Update Spider.java#1052

Open
GG22G2 wants to merge 1 commit intocode4craft:developcode4craft/webmagic:developfrom
GG22G2:patch-1GG22G2/webmagic:patch-1Copy head branch name to clipboard
Open

Update Spider.java#1052
GG22G2 wants to merge 1 commit intocode4craft:developcode4craft/webmagic:developfrom
GG22G2:patch-1GG22G2/webmagic:patch-1Copy head branch name to clipboard

Conversation

@GG22G2
Copy link

@GG22G2 GG22G2 commented Jan 6, 2022

根据响应状态码判断是否走重试机制

根据响应状态码判断是否走重试机制
page = downloader.download(request, this);
}
if (page.isDownloadSuccess()){
if (page.isDownloadSuccess()&&site.getAcceptStatCode().contains(page.getStatusCode())){
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不是应该改 isDownloadSuccess 方法?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不是应该改 isDownloadSuccess 方法?

我感觉都可以

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不是应该改 isDownloadSuccess 方法?

我只是把onDownloadSuccess中的判断提前到processRequest中了。如果修改isDownloadSuccess,就不能借助Site.acceptStatCode了,或者要改动的会更多一点。

Copy link
Collaborator

@sutra sutra Jan 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

后面调用的 onDownloadSucess 里其实有 if (site.getAcceptStatCode().contains(page.getStatusCode())){ 感觉这整个逻辑有点乱。可以帮忙再多考虑一些。

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

Successfully merging this pull request may close these issues.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.