From 477b64b15330e183bae34ebcc73647dabba10341 Mon Sep 17 00:00:00 2001 From: kclauhk <78251477+kclauhk@users.noreply.github.com> Date: Sat, 7 Sep 2024 17:20:05 +0800 Subject: [PATCH] fix entries' `webpage_url_basename` --- yt_dlp/extractor/giphy.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/yt_dlp/extractor/giphy.py b/yt_dlp/extractor/giphy.py index 0751a46f36..fd76ee9593 100644 --- a/yt_dlp/extractor/giphy.py +++ b/yt_dlp/extractor/giphy.py @@ -8,6 +8,7 @@ merge_dicts, str_or_none, traverse_obj, + url_basename, url_or_none, ) @@ -110,6 +111,7 @@ def _api_channel_feed(self, channel_id): yield { **self._extract_info(video, video['id']), 'webpage_url': video['url'], + 'webpage_url_basename': url_basename(video['url']), } count += len(search_results.get('results')) if count >= (int_or_none(self.get_param('playlistend')) or (self._GIPHY_MAX + 1)): @@ -169,12 +171,12 @@ class GiphyIE(GiphyBaseIE): 'ext': 'mp4', 'title': 'You Can\'t Break Up With Me', 'description': 'South Park, Season 20, Episode 4, Wieners Out', - 'tags': 'count:16', + 'tags': 'count:17', 'thumbnail': r're:^https?://.*', 'upload_date': '20220516', 'uploader': 'South Park', 'uploader_id': 'southpark', - 'uploader_url': 'https://giphy.com/southpark', + 'uploader_url': 'https://giphy.com/southpark/', }, }, { 'url': 'https://giphy.com/stickers/mario-PFxFYEZNUavG8', @@ -431,6 +433,7 @@ def search_query(query, offset, limit, category): yield { **self._extract_info(video, video['id']), 'webpage_url': video['url'], + 'webpage_url_basename': url_basename(video['url']), } if len(search_results['data']) < limit: total = offset + len(search_results['data']) @@ -503,6 +506,7 @@ def _real_extract(self, url): **self._extract_info(video['gif'], video['gif']['id']), 'description': video['caption'], 'webpage_url': video['gif']['url'], + 'webpage_url_basename': url_basename(video['gif']['url']), }) info = traverse_obj(data, { 'id': ('story_id', {lambda x: x or slug}),