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:
parent
c7153f95be
commit
cd4ccf7968
@ -1,5 +1,5 @@
|
|||||||
import re
|
import re
|
||||||
from urllib import parse
|
import urllib.parse
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
@ -151,7 +151,8 @@ def _real_extract(self, url):
|
|||||||
if plugin_data:
|
if plugin_data:
|
||||||
site_id = self._html_search_regex(r'site:(\d+)', webpage, 'site id', default=None)
|
site_id = self._html_search_regex(r'site:(\d+)', webpage, 'site id', default=None)
|
||||||
if site_id is 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:
|
for video_data in plugin_data:
|
||||||
video_id = self._parse_json(video_data, title)['video']
|
video_id = self._parse_json(video_data, title)['video']
|
||||||
entries.append({
|
entries.append({
|
||||||
@ -182,7 +183,7 @@ def _real_extract(self, url):
|
|||||||
for embedded_video in embedded_videos:
|
for embedded_video in embedded_videos:
|
||||||
video_data = extract_attributes(embedded_video)
|
video_data = extract_attributes(embedded_video)
|
||||||
url = video_data.get('src') or ''
|
url = video_data.get('src') or ''
|
||||||
hostname = parse.urlparse(url).hostname
|
hostname = urllib.parse.urlparse(url).hostname
|
||||||
if hostname == 'www.youtube.com':
|
if hostname == 'www.youtube.com':
|
||||||
entries.append(self.url_result(url, ie='Youtube'))
|
entries.append(self.url_result(url, ie='Youtube'))
|
||||||
elif hostname == 'www.redditmedia.com':
|
elif hostname == 'www.redditmedia.com':
|
||||||
|
Loading…
Reference in New Issue
Block a user