1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-08-15 08:58:28 +00:00

Apply review suggestions

This commit is contained in:
sepro 2025-08-02 23:59:51 +02:00
parent c5b0479c8d
commit 5016cfe038

View File

@ -1,24 +1,34 @@
import json
from .common import InfoExtractor from .common import InfoExtractor
from .vimeo import VimeoIE from .vimeo import VimeoIE
from ..utils import extract_attributes
from ..utils.traversal import find_element, traverse_obj
class ShieyIE(InfoExtractor): class ShieyIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?shiey\.com/videos/v/(?P<id>[^/]+)' _VALID_URL = r'https?://(?:www\.)?shiey\.com/videos/v/(?P<id>[^/?#]+)'
_TESTS = [{ _TESTS = [{
'url': 'https://www.shiey.com/videos/v/train-journey-to-edge-of-serbia-ep-2', 'url': 'https://www.shiey.com/videos/v/train-journey-to-edge-of-serbia-ep-2',
'info_dict': { 'info_dict': {
'id': 'train-journey-to-edge-of-serbia-ep-2', 'id': '1103409448',
'title': 'Train Journey to the Edge of Serbia - Ep. 2', 'ext': 'mp4',
'uploader': 'Shiey', 'title': 'Train Journey To Edge of Serbia (Ep. 2)',
}, 'uploader': 'shiey',
'params': { 'uploader_url': '',
'skip_download': True, 'duration': 1364,
'thumbnail': r're:^https?://.+',
}, },
'params': {'skip_download': True},
'expected_warnings': ['Failed to parse XML: not well-formed'],
}] }]
def _real_extract(self, url): def _real_extract(self, url):
video_id = self._match_id(url) video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id) webpage = self._download_webpage(url, video_id)
vimeo_url = self._search_regex(r'iframe src=\\&quot;(https?://player\.vimeo\.com/video/[^\\&]+)', webpage, 'vimeo url') oembed_html = traverse_obj(webpage, (
return self.url_result(VimeoIE._smuggle_referrer(vimeo_url, url), VimeoIE) {find_element(attr='data-controller', value='VideoEmbed', html=True)},
{extract_attributes}, 'data-config-embed-video', {json.loads}, 'oembedHtml', {str}))
return self.url_result(VimeoIE._extract_url(url, oembed_html), VimeoIE)