File tree Expand file tree Collapse file tree 2 files changed +11
-11
lines changed Expand file tree Collapse file tree 2 files changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -576,10 +576,8 @@ async def get_total_category_pages(self, category):
576
576
working_page = current_page
577
577
current_page *= 2
578
578
579
- # Check the page in the middle of highest known working page and
580
- # current page until they have the same page number.
581
579
while True :
582
- page = working_page + ( current_page - working_page ) / 2
580
+ page = working_page + math . floor (( current_page - working_page ) / 2 )
583
581
headers ["page" ] = str (page )
584
582
585
583
async with session .get (url , headers = headers ) as response :
@@ -590,9 +588,13 @@ async def get_total_category_pages(self, category):
590
588
else :
591
589
current_page = page
592
590
593
- if math . floor ( current_page ) == math . floor ( working_page ) :
591
+ if current_page - 1 == working_page :
594
592
break
595
593
596
- total_pages = math . floor ( working_page )
594
+ total_pages = working_page
597
595
598
- return total_pages
596
+ return {
597
+ "code" : 200 ,
598
+ "message" : "OK" ,
599
+ "data" : {"total_pages" : total_pages },
600
+ }
Original file line number Diff line number Diff line change @@ -539,10 +539,8 @@ def get_total_category_pages(self, category):
539
539
working_page = current_page
540
540
current_page *= 2
541
541
542
- # Check the page in the middle of highest known working page and
543
- # current page until they have the same page number.
544
542
while True :
545
- page = working_page + ( current_page - working_page ) / 2
543
+ page = working_page + math . floor (( current_page - working_page ) / 2 )
546
544
headers ["page" ] = str (page )
547
545
548
546
response = requests .get (url , headers = headers , timeout = 10 )
@@ -553,10 +551,10 @@ def get_total_category_pages(self, category):
553
551
else :
554
552
current_page = page
555
553
556
- if math . floor ( current_page ) == math . floor ( working_page ) :
554
+ if current_page - 1 == working_page :
557
555
break
558
556
559
- total_pages = math . floor ( working_page )
557
+ total_pages = working_page
560
558
561
559
return {
562
560
"code" : 200 ,
You can’t perform that action at this time.
0 commit comments