mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-11-16 15:35:51 +00:00
Fixed flake8
Search title from multiple sources
This commit is contained in:
parent
14bedfc938
commit
c2f08dd505
1 changed files with 7 additions and 4 deletions
|
@ -10,6 +10,7 @@ from ..utils import (
|
||||||
# VALID_STREAMS = ('dash', 'hls', )
|
# VALID_STREAMS = ('dash', 'hls', )
|
||||||
VALID_STREAMS = ('dash', )
|
VALID_STREAMS = ('dash', )
|
||||||
|
|
||||||
|
|
||||||
class MxplayerIE(InfoExtractor):
|
class MxplayerIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://(?:www\.)?mxplayer\.in/movie/(?P<slug>[a-z0-9]+(?:-[a-z0-9]+)*)'
|
_VALID_URL = r'https?://(?:www\.)?mxplayer\.in/movie/(?P<slug>[a-z0-9]+(?:-[a-z0-9]+)*)'
|
||||||
# _VALID_URL = r'https?://(?:www\.)?mxplayer\.in/movie/(?P<title>.*)[-](?P<id>.+)$'
|
# _VALID_URL = r'https?://(?:www\.)?mxplayer\.in/movie/(?P<title>.*)[-](?P<id>.+)$'
|
||||||
|
@ -69,6 +70,9 @@ class MxplayerIE(InfoExtractor):
|
||||||
video_dict = source['entities'][video_id]
|
video_dict = source['entities'][video_id]
|
||||||
stream_urls = self._get_stream_urls(video_dict)
|
stream_urls = self._get_stream_urls(video_dict)
|
||||||
|
|
||||||
|
if not title:
|
||||||
|
title = self._og_search_title(webpage, fatal=True, default=video_dict['title'])
|
||||||
|
|
||||||
formats = []
|
formats = []
|
||||||
headers = {'Referer': url}
|
headers = {'Referer': url}
|
||||||
for stream_name, stream_url in stream_urls:
|
for stream_name, stream_url in stream_urls:
|
||||||
|
@ -77,13 +81,13 @@ class MxplayerIE(InfoExtractor):
|
||||||
if not format_url:
|
if not format_url:
|
||||||
continue
|
continue
|
||||||
formats.extend(self._extract_mpd_formats(
|
formats.extend(self._extract_mpd_formats(
|
||||||
format_url, video_id, mpd_id='dash', headers=headers))
|
format_url, video_id, mpd_id='dash', headers=headers))
|
||||||
|
|
||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
info = {
|
info = {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'ext': 'mpd',
|
'ext': 'mpd',
|
||||||
'title': video_dict.get('title') or title,
|
'title': title,
|
||||||
'description': video_dict.get('description'),
|
'description': video_dict.get('description'),
|
||||||
'formats': formats
|
'formats': formats
|
||||||
}
|
}
|
||||||
|
@ -91,11 +95,10 @@ class MxplayerIE(InfoExtractor):
|
||||||
if video_dict.get('imageInfo'):
|
if video_dict.get('imageInfo'):
|
||||||
info['thumbnails'] = list(map(lambda i: dict(i, **{
|
info['thumbnails'] = list(map(lambda i: dict(i, **{
|
||||||
'url': urljoin(config_dict['imageBaseUrl'], i['url'])
|
'url': urljoin(config_dict['imageBaseUrl'], i['url'])
|
||||||
}) , video_dict['imageInfo']))
|
}), video_dict['imageInfo']))
|
||||||
|
|
||||||
if video_dict.get('webUrl'):
|
if video_dict.get('webUrl'):
|
||||||
last_part = video_dict['webUrl'].split("/")[-1]
|
last_part = video_dict['webUrl'].split("/")[-1]
|
||||||
info['display_id'] = last_part.replace(video_id, "").rstrip("-")
|
info['display_id'] = last_part.replace(video_id, "").rstrip("-")
|
||||||
|
|
||||||
return info
|
return info
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue