The CDX Server can return results matching a certain prefix, a certain host or all subdomains by using the ``matchType`` param.
-For example, with the value ``prefix`` it is possible to retrieve URLs beyond `/status/`.
+The package ``waybacktweets`` uses the pathname ``/status`` followed by the wildcard '*' at the end of the URL to retrieve only tweets. However, if a value is provided for this parameter, the search will be made from the URL `twitter.com/<USERNAME>`.
Read below text extracted from the official Wayback CDX Server API (Beta) documentation.
"""
url = "https://web.archive.org/cdx/search/cdx"
- status = "/status/*"
- if self.matchtype != "exact":
- status = ""
+ status_pathname = "status/*"
+ if self.matchtype:
+ status_pathname = ""
params = {
- "url": f"https://twitter.com/{self.username}{status}",
+ "url": f"https://twitter.com/{self.username}/{status_pathname}",
"output": "json",
}