Skip to content

Commit

Permalink
update code
Browse files Browse the repository at this point in the history
  • Loading branch information
Li WenJie committed Nov 7, 2019
1 parent f37b91c commit c5910d5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
5 changes: 1 addition & 4 deletions main_cookies.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
from src.login import Login
from src.article_id_spider import ArticleIdSpider
from src.article_content_spider import ArticleContentSpider
import os
import yaml
from src.article_id_spider import ArticleIdSpider

"""
Auther : SnailMann
Expand Down
6 changes: 3 additions & 3 deletions src/article_id_spider.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ def _fetch_pagesize(self, url):

for script_content in scripts:
# size of per page
pre_pagesize = re.findall(r'pageSize = (\d*)', repr(script_content))
per_pagesize = re.findall(r'pageSize = (\d*)', repr(script_content))
# total number of articles
total_size = re.findall(r'listTotal = (\d*)', repr(script_content))
if pre_pagesize and total_size:
if per_pagesize and total_size:
# math.ceil
pagesize = math.ceil(int(total_size[0]) / int(pre_pagesize[0]))
pagesize = math.ceil(int(total_size[0]) / int(per_pagesize[0]))
break
return pagesize

0 comments on commit c5910d5

Please sign in to comment.