1
0
mirror of https://github.com/l1ving/youtube-dl synced 2025-03-13 11:59:42 +08:00

Fixing video url retreiving for some kind of videos

This commit is contained in:
dabiboo 2015-10-11 22:53:09 +02:00
parent 63d1473b8b
commit 9afad4c4a4
2 changed files with 16 additions and 14 deletions

View File

@ -17,14 +17,13 @@ class UniversalMusicFranceIE(InfoExtractor):
_TESTS = [ _TESTS = [
{ {
'url': 'http://www.universalmusic.fr/artiste/7415-anna-bergendahl/videos/4555-for-you-remix-lyric-video.iframe', 'url': 'http://www.universalmusic.fr/artiste/7415-anna-bergendahl/videos/4555-for-you-remix-lyric-video.iframe',
'md5': '159cda7568b9fc1e5e3de6aeca5d4bfc)', 'md5': '159cda7568b9fc1e5e3de6aeca5d4bfc',
'info_dict': { 'info_dict': {
'id': '1881-waiting-for-love-lyric-video', 'id': '4555-for-you-remix-lyric-video.iframe',
'ext': 'mp4', 'ext': 'mp4',
'title': '1881-waiting-for-love-lyric-video' 'title': 'For You - Anna Bergendahl'
} }
} },
,
{ {
'url': 'https://www.universalmusic.fr/artiste/4428-avicii/videos/1881-waiting-for-love-lyric-video#contentPart', 'url': 'https://www.universalmusic.fr/artiste/4428-avicii/videos/1881-waiting-for-love-lyric-video#contentPart',
'md5': '159cda7568b9fc1e5e3de6aeca5d4bfc)', 'md5': '159cda7568b9fc1e5e3de6aeca5d4bfc)',
@ -33,8 +32,7 @@ class UniversalMusicFranceIE(InfoExtractor):
'ext': 'mp4', 'ext': 'mp4',
'title': '1881-waiting-for-love-lyric-video' 'title': '1881-waiting-for-love-lyric-video'
} }
} },
,
{ {
# from http://www.wat.tv/video/anna-bergendahl-for-you-2015-7dvjn_76lkz_.html # from http://www.wat.tv/video/anna-bergendahl-for-you-2015-7dvjn_76lkz_.html
'url': 'http://www.universalmusic.fr/artiste/7415-anna-bergendahl/videos/4555-for-you-remix-lyric-video', 'url': 'http://www.universalmusic.fr/artiste/7415-anna-bergendahl/videos/4555-for-you-remix-lyric-video',
@ -51,8 +49,12 @@ class UniversalMusicFranceIE(InfoExtractor):
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)
urlVideo = self._html_search_regex(r'var urlVideo = \'(.*)\';', webpage, 'urlVideo') if (webpage.__contains__('var urlVideo')):
title = self._html_search_regex(r'<meta\s*property="?og:title"?\s*content="(.*)"\s*/>', webpage, 'title') urlVideo = self._html_search_regex(r'var urlVideo = \'(.*)\';', webpage, 'urlVideo')
title = self._html_search_regex(r'<meta\s*property="?og:title"?\s*content="(.*)"\s*/>', webpage, 'title')
else:
urlVideo = self._html_search_regex(r'\'videoUrl\': \'(.*)\'', webpage, 'urlVideo')
title = self._html_search_regex(r'<title>(.*)</title>', webpage, 'title')
request = compat_urllib_request.Request(self.GET_TOKEN_URL, urlencode_postdata({'videoUrl': urlVideo})) request = compat_urllib_request.Request(self.GET_TOKEN_URL, urlencode_postdata({'videoUrl': urlVideo}))
request.add_header('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8') request.add_header('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8')

View File

@ -17,13 +17,13 @@ class WatIE(InfoExtractor):
_TESTS = [ _TESTS = [
{ {
'url': 'http://www.wat.tv/video/lady-gaga-but-beautiful-2014-72611_2ey39_.html', 'url': 'http://www.wat.tv/video/lady-gaga-but-beautiful-2014-72611_2ey39_.html',
'md5': '159cda7568b9fc1e5e3de6aeca5d4bfc', 'md5': 'b7a3a5d2af2c7f16551265ef8929d8e5',
'info_dict': { 'info_dict': {
'id': 'lady-gaga-but-beautiful', 'id': '18879-but-beautiful',
'display_id': 'lady-gaga-but-beautiful', 'display_id': '18879-but-beautiful',
'ext': 'mp4', 'ext': 'mp4',
'title': 'lady-gaga-but-beautiful', 'title': 'But Beautiful - Lady Gaga - Universal Music France',
'description': 'md5:1bbdde8d44751f43367ba68e8b9966a6' 'description': 'md5:7e0bff92535f1e5912d61dffe9845aa7'
}, },
}, },
{ {