fix entries' webpage_url_basename

This commit is contained in:
kclauhk 2024-09-07 17:20:05 +08:00
parent e60917c379
commit 477b64b153

View File

@ -8,6 +8,7 @@
merge_dicts, merge_dicts,
str_or_none, str_or_none,
traverse_obj, traverse_obj,
url_basename,
url_or_none, url_or_none,
) )
@ -110,6 +111,7 @@ def _api_channel_feed(self, channel_id):
yield { yield {
**self._extract_info(video, video['id']), **self._extract_info(video, video['id']),
'webpage_url': video['url'], 'webpage_url': video['url'],
'webpage_url_basename': url_basename(video['url']),
} }
count += len(search_results.get('results')) count += len(search_results.get('results'))
if count >= (int_or_none(self.get_param('playlistend')) or (self._GIPHY_MAX + 1)): if count >= (int_or_none(self.get_param('playlistend')) or (self._GIPHY_MAX + 1)):
@ -169,12 +171,12 @@ class GiphyIE(GiphyBaseIE):
'ext': 'mp4', 'ext': 'mp4',
'title': 'You Can\'t Break Up With Me', 'title': 'You Can\'t Break Up With Me',
'description': 'South Park, Season 20, Episode 4, Wieners Out', 'description': 'South Park, Season 20, Episode 4, Wieners Out',
'tags': 'count:16', 'tags': 'count:17',
'thumbnail': r're:^https?://.*', 'thumbnail': r're:^https?://.*',
'upload_date': '20220516', 'upload_date': '20220516',
'uploader': 'South Park', 'uploader': 'South Park',
'uploader_id': 'southpark', 'uploader_id': 'southpark',
'uploader_url': 'https://giphy.com/southpark', 'uploader_url': 'https://giphy.com/southpark/',
}, },
}, { }, {
'url': 'https://giphy.com/stickers/mario-PFxFYEZNUavG8', 'url': 'https://giphy.com/stickers/mario-PFxFYEZNUavG8',
@ -431,6 +433,7 @@ def search_query(query, offset, limit, category):
yield { yield {
**self._extract_info(video, video['id']), **self._extract_info(video, video['id']),
'webpage_url': video['url'], 'webpage_url': video['url'],
'webpage_url_basename': url_basename(video['url']),
} }
if len(search_results['data']) < limit: if len(search_results['data']) < limit:
total = offset + len(search_results['data']) total = offset + len(search_results['data'])
@ -503,6 +506,7 @@ def _real_extract(self, url):
**self._extract_info(video['gif'], video['gif']['id']), **self._extract_info(video['gif'], video['gif']['id']),
'description': video['caption'], 'description': video['caption'],
'webpage_url': video['gif']['url'], 'webpage_url': video['gif']['url'],
'webpage_url_basename': url_basename(video['gif']['url']),
}) })
info = traverse_obj(data, { info = traverse_obj(data, {
'id': ('story_id', {lambda x: x or slug}), 'id': ('story_id', {lambda x: x or slug}),