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

Apply suggestions from code review

This commit is contained in:
bashonly 2025-08-02 20:06:16 +00:00 committed by GitHub
parent c7153f95be
commit cd4ccf7968
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,5 +1,5 @@
import re
from urllib import parse
import urllib.parse
from .common import InfoExtractor
from ..utils import (
@ -151,7 +151,8 @@ def _real_extract(self, url):
if plugin_data:
site_id = self._html_search_regex(r'site:(\d+)', webpage, 'site id', default=None)
if site_id is None:
site_id = re.search(r'partners/(\d+)', self._html_search_meta('contentUrl', webpage)).group(1)
site_id = self._search_regex(
r'partners/(\d+)', self._html_search_meta('contentUrl', webpage, fatal=True), 'site ID')
for video_data in plugin_data:
video_id = self._parse_json(video_data, title)['video']
entries.append({
@ -182,7 +183,7 @@ def _real_extract(self, url):
for embedded_video in embedded_videos:
video_data = extract_attributes(embedded_video)
url = video_data.get('src') or ''
hostname = parse.urlparse(url).hostname
hostname = urllib.parse.urlparse(url).hostname
if hostname == 'www.youtube.com':
entries.append(self.url_result(url, ie='Youtube'))
elif hostname == 'www.redditmedia.com':