From a65990aee320ec401d9364801220dc044c22ebbc Mon Sep 17 00:00:00 2001 From: Akash Mahanty Date: Tue, 12 Jan 2021 09:46:07 +0530 Subject: [PATCH] don't use pagination API if total pages <= 2 --- waybackpy/cdx.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/waybackpy/cdx.py b/waybackpy/cdx.py index e5f2b2b..e4d1a4d 100644 --- a/waybackpy/cdx.py +++ b/waybackpy/cdx.py @@ -83,10 +83,10 @@ class Cdx: """ endpoint = "https://web.archive.org/cdx/search/cdx" - - if use_page == True: - - total_pages = _get_total_pages(self.url, self.user_agent) + total_pages = _get_total_pages(self.url, self.user_agent) + #If we only have two or less pages of archives then we care for accuracy + # pagination API can be lagged sometimes + if use_page == True and total_pages >= 2: blank_pages = 0 for i in range(total_pages): payload["page"] = str(i)