diff --git a/waybackpy/cdx_api.py b/waybackpy/cdx_api.py index 4bd8291..b89da38 100644 --- a/waybackpy/cdx_api.py +++ b/waybackpy/cdx_api.py @@ -336,7 +336,7 @@ class WaybackMachineCDXServerAPI: """ return self.near(year=1994, month=1, day=1) - def snapshots(self) -> Generator[CDXSnapshot, None, None]: + def snapshots(self, reverse: bool = False) -> Generator[CDXSnapshot, None, None]: """ This function yields the CDX data lines as snapshots. @@ -373,6 +373,9 @@ class WaybackMachineCDXServerAPI: # at once, thus there should be no issues of too much memory usage. snapshot_list = entry.split("\n") + if reverse: + snapshot_list.reverse() + for snapshot in snapshot_list: # 14 + 32 == 46 ( timestamp + digest ), ignore the invalid entries.