diff options
Diffstat (limited to 'gallery_dl/extractor/twibooru.py')
| -rw-r--r-- | gallery_dl/extractor/twibooru.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/gallery_dl/extractor/twibooru.py b/gallery_dl/extractor/twibooru.py index 4f9fe84..e21ef2a 100644 --- a/gallery_dl/extractor/twibooru.py +++ b/gallery_dl/extractor/twibooru.py @@ -37,8 +37,7 @@ class TwibooruExtractor(BooruExtractor): return post["view_url"] def _prepare(self, post): - post["date"] = text.parse_datetime( - post["created_at"], "%Y-%m-%dT%H:%M:%S.%fZ") + post["date"] = self.parse_datetime_iso(post["created_at"]) if "name" in post: name, sep, rest = post["name"].rpartition(".") @@ -49,7 +48,7 @@ class TwibooruPostExtractor(TwibooruExtractor): """Extractor for single twibooru posts""" subcategory = "post" request_interval = (0.5, 1.5) - pattern = BASE_PATTERN + r"/(\d+)" + pattern = rf"{BASE_PATTERN}/(\d+)" example = "https://twibooru.org/12345" def __init__(self, match): @@ -64,7 +63,7 @@ class TwibooruSearchExtractor(TwibooruExtractor): """Extractor for twibooru search results""" subcategory = "search" directory_fmt = ("{category}", "{search_tags}") - pattern = BASE_PATTERN + r"/(?:search/?\?([^#]+)|tags/([^/?#]+))" + pattern = rf"{BASE_PATTERN}/(?:search/?\?([^#]+)|tags/([^/?#]+))" example = "https://twibooru.org/search?q=TAG" def __init__(self, match): @@ -98,7 +97,7 @@ class TwibooruGalleryExtractor(TwibooruExtractor): subcategory = "gallery" directory_fmt = ("{category}", "galleries", "{gallery[id]} {gallery[title]}") - pattern = BASE_PATTERN + r"/galleries/(\d+)" + pattern = rf"{BASE_PATTERN}/galleries/(\d+)" example = "https://twibooru.org/galleries/12345" def __init__(self, match): @@ -146,8 +145,8 @@ class TwibooruAPI(): return response.json() if response.status_code == 429: - until = text.parse_datetime( - response.headers["X-RL-Reset"], "%Y-%m-%d %H:%M:%S %Z") + until = self.parse_datetime_iso( + response.headers["X-RL-Reset"][:19]) # wait an extra minute, just to be safe self.extractor.wait(until=until, adjust=60.0) continue |
