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

Fix the crawling of toutiao article urls. #536

Merged
merged 1 commit into from
Aug 27, 2023
Merged
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
6 changes: 3 additions & 3 deletions weibo_spider/parser/page_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def get_one_page(self, weibo_id_list):
publish_time = datetime_util.str_to_time(
weibo.publish_time)

if publish_time < since_date:
if publish_time < since_date:
# As of 2023.05, there can be at most 2 pinned weibo.
# We will continue for at most 2 times before return.
if self.page == 1 and cur_pinned_count < MAX_PINNED_COUNT:
Expand Down Expand Up @@ -158,9 +158,9 @@ def get_article_url(self, info):
"""获取微博头条文章的url"""
article_url = ''
text = handle_garbled(info)
if text.startswith(u'发布了头条文章'):
if text.startswith(u'发布了头条文章') or text.startswith(u'我发表了头条文章'):
url = info.xpath('.//a/@href')
if url and url[0].startswith('https://weibo.cn/sinaurl'):
if url and url[0].startswith('https://weibo.com/ttarticle'):
article_url = url[0]
return article_url

Expand Down
Loading