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

Update Spider.java #1052

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ private void processRequest(Request request) {
}else {
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())){ 感觉这整个逻辑有点乱。可以帮忙再多考虑一些。

onDownloadSuccess(request, page);
} else {
onDownloaderFail(request);
Expand Down