Added rules for legacy videos that don't use m3u8 files
This commit is contained in:
parent
29b076ad6c
commit
f2c7a7f1b1
@ -4,7 +4,7 @@ from __future__ import unicode_literals
|
|||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from .once import OnceIE
|
from .common import InfoExtractor
|
||||||
from ..compat import (
|
from ..compat import (
|
||||||
compat_urllib_parse_unquote,
|
compat_urllib_parse_unquote,
|
||||||
)
|
)
|
||||||
@ -15,19 +15,31 @@ from ..utils import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class PietsmietIE(OnceIE):
|
class PietsmietIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://(?:www\.)?pietsmiet\.de/gallery/(categories|playlists)/[\w-]+/(?P<id>\d+)-.*/?'
|
_VALID_URL = r'https?://(?:www\.)?pietsmiet\.de/gallery/(categories|playlists)/[\w-]+/(?P<id>\d+)-.*/?'
|
||||||
_TEST = {
|
_TESTS = [
|
||||||
'url': 'http://www.pietsmiet.de/gallery/categories/8-frag-pietsmiet/29844-fps-912',
|
{
|
||||||
'info_dict': {
|
'url': 'https://www.pietsmiet.de/gallery/categories/8-frag-pietsmiet/29844-fps-912',
|
||||||
'id': '29844',
|
'info_dict': {
|
||||||
'ext': 'mp4',
|
'id': '29844',
|
||||||
'title': 'Was würdet ihr die Maus fragen? 🎮 Frag PietSmiet #912',
|
'ext': 'mp4',
|
||||||
},
|
'title': 'Was würdet ihr die Maus fragen? 🎮 Frag PietSmiet #912',
|
||||||
'params': {
|
},
|
||||||
'skip_download': True, # m3u8 downloads
|
'params': {
|
||||||
},
|
'skip_download': True, # m3u8 downloads
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
'url': 'https://www.pietsmiet.de/gallery/playlists/646-metal-gear-solid-1/19804-metal-gear-solid-1-sniper-wolf-rematch',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '19804',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'SNIPER WOLF REMATCH 🎮 Metal Gear Solid #9'
|
||||||
|
},
|
||||||
|
'params': {
|
||||||
|
'skip_download': True, # m3u8 downloads
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
page_id = self._match_id(url)
|
page_id = self._match_id(url)
|
||||||
@ -39,17 +51,16 @@ class PietsmietIE(OnceIE):
|
|||||||
|
|
||||||
formats = []
|
formats = []
|
||||||
|
|
||||||
m3u8_manifest_url = data_video['sources'][0]['file']
|
m3u8_manifest_urls = filter(lambda x: x['file'].endswith('m3u8'), data_video['sources'])
|
||||||
m3u8_formats = self._extract_m3u8_formats(
|
for f in m3u8_manifest_urls:
|
||||||
m3u8_manifest_url, page_id, 'mp4', 'm3u8_native',
|
m3u8_formats = self._extract_m3u8_formats(
|
||||||
m3u8_id='hls')
|
f['file'], page_id, 'mp4', 'm3u8_native', m3u8_id='hls')
|
||||||
|
|
||||||
formats.extend(m3u8_formats)
|
formats.extend(m3u8_formats)
|
||||||
|
|
||||||
if len(data_video['sources']) > 1:
|
mp4_urls = filter(lambda x: not x['file'].endswith('m3u8'), data_video['sources'])
|
||||||
http_video = data_video['sources'][1]
|
for m in mp4_urls:
|
||||||
|
label = m.get('label')
|
||||||
label = http_video.get('label')
|
|
||||||
format_height = 0
|
format_height = 0
|
||||||
|
|
||||||
if label:
|
if label:
|
||||||
@ -64,16 +75,16 @@ class PietsmietIE(OnceIE):
|
|||||||
|
|
||||||
formats.append({
|
formats.append({
|
||||||
'format_id': 'http-{0}'.format(label),
|
'format_id': 'http-{0}'.format(label),
|
||||||
'url': "https:{0}".format(http_video['file']),
|
'url': "https:{0}".format(m['file']),
|
||||||
'ext': http_video.get('type'),
|
'ext': m.get('type'),
|
||||||
'width': int_or_none(format_width),
|
'width': int_or_none(format_width),
|
||||||
'height': format_height,
|
'height': format_height,
|
||||||
'fps': 30.0,
|
'fps': 30.0,
|
||||||
})
|
})
|
||||||
else:
|
else:
|
||||||
formats.append({
|
formats.append({
|
||||||
'url': "https:{0}".format(http_video['file']),
|
'url': "https:{0}".format(m['file']),
|
||||||
'ext': http_video.get('type'),
|
'ext': m.get('type'),
|
||||||
'fps': 30.0,
|
'fps': 30.0,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user