diff options
Diffstat (limited to 'gallery_dl/extractor/tenor.py')
| -rw-r--r-- | gallery_dl/extractor/tenor.py | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/gallery_dl/extractor/tenor.py b/gallery_dl/extractor/tenor.py index 7e1f802..3e4bab0 100644 --- a/gallery_dl/extractor/tenor.py +++ b/gallery_dl/extractor/tenor.py @@ -40,16 +40,17 @@ class TenorExtractor(Extractor): continue url = fmt["url"] + title = gif.pop("h1_title", "") + gif["title"] = title[:-4] if title.endswith(" GIF") else title + gif["width"], gif["height"] = fmt.pop("dims") or (0, 0) + gif["description"] = gif.pop("content_description", "") gif["id_format"] = url.rsplit("/", 2)[1] gif["format"] = fmt["name"] - gif["width"], gif["height"] = fmt["dims"] gif["duration"] = fmt["duration"] gif["size"] = fmt["size"] - gif["title"] = gif["h1_title"][:-4] - gif["description"] = gif.pop("content_description", "") - gif["date"] = text.parse_timestamp(gif["created"]) + gif["date"] = self.parse_timestamp(gif["created"]) - yield Message.Directory, gif + yield Message.Directory, "", gif yield Message.Url, url, text.nameext_from_url(url, gif) def _extract_format(self, gif): @@ -110,7 +111,7 @@ class TenorExtractor(Extractor): class TenorImageExtractor(TenorExtractor): subcategory = "image" - pattern = BASE_PATTERN + r"view/(?:[^/?#]*-)?(\d+)" + pattern = rf"{BASE_PATTERN}view/(?:[^/?#]*-)?(\d+)" example = "https://tenor.com/view/SLUG-1234567890" def gifs(self): @@ -124,7 +125,7 @@ class TenorImageExtractor(TenorExtractor): class TenorSearchExtractor(TenorExtractor): subcategory = "search" directory_fmt = ("{category}", "{search_tags}") - pattern = BASE_PATTERN + r"search/([^/?#]+)" + pattern = rf"{BASE_PATTERN}search/([^/?#]+)" example = "https://tenor.com/search/QUERY" def gifs(self): @@ -140,7 +141,7 @@ class TenorSearchExtractor(TenorExtractor): class TenorUserExtractor(TenorExtractor): subcategory = "user" directory_fmt = ("{category}", "@{user[username]}") - pattern = BASE_PATTERN + r"(?:users|official)/([^/?#]+)" + pattern = rf"{BASE_PATTERN}(?:users|official)/([^/?#]+)" example = "https://tenor.com/users/USER" def gifs(self): |
