1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2025-02-17 01:17:54 +01:00

[foxcomtr] cleaning code, adding more tests

This commit is contained in:
Ozan Karaali 2019-10-13 01:21:07 +03:00
parent 530de68096
commit 94e2e0eec0

View File

@ -2,7 +2,6 @@
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import unsmuggle_url
class FoxComTrIE(InfoExtractor):
@ -26,26 +25,38 @@ class FoxComTrIE(InfoExtractor):
'title': 'FOX | Mucize Doktor 2. Bölüm',
}
},
{
'url': 'https://www.foxplay.com.tr/4N1K-2/izle',
'md5': '74fb90d11d519c194e31b77e966bb252',
'info_dict': {
'id': 'izle',
'ext': 'ts',
'title': '4N1K 2 FOXPlay\'de | Ücretsiz HD Kalitede Film İzle',
}
},
{
'url': 'https://www.foxplay.com.tr/Mucize-Doktor/bolumler/4-bolum',
'md5': '38a8f999e236758f00e7f487560a59ad',
'info_dict': {
'id': '4-bolum',
'ext': 'ts',
'title': 'Mucize Doktor Dizisi 4. Bölümü İzle',
}
},
]
def _real_extract(self, url):
url, smuggled_data = unsmuggle_url(url)
if smuggled_data and 'force_videoid' in smuggled_data:
force_videoid = smuggled_data['force_videoid']
video_id = force_videoid
else:
video_id = self._generic_id(url)
video_id = self._generic_id(url)
webpage = self._download_webpage(url, video_id)
title = self._og_search_title(
webpage, default=None) or self._html_search_regex(
r'(?s)<title>(.*?)</title>', webpage, 'video title',
default='video')
title = self._og_search_title(webpage, default=None).strip()
m3u8_url = self._html_search_regex(r"videoSrc : '(.*)'", webpage, 'root_url')
m3u8_url = self._html_search_regex(r"videoSrc : '(.*)'",
webpage, 'root_url')
return {
'id': video_id,
'title': title,
'formats': reversed(self._extract_m3u8_formats(m3u8_url, video_id, 'ts', 'm3u8_native', fatal=False)),
'formats': reversed(self._extract_m3u8_formats(
m3u8_url, video_id, 'ts', 'm3u8_native')),
}