Compare commits

...

4 Commits

Author SHA1 Message Date
Maciej Krüger
c5dffddb55
Merge d4d99b1b51 into c5098961b0 2024-08-09 11:54:07 +02:00
dirkf
d4d99b1b51
Linty 2022-11-17 19:29:59 +00:00
dirkf
001d5b8395
Fix extraction 2022-11-17 19:23:43 +00:00
Maciej Krüger
8d2881a442
[voe] Add new extractor 2021-07-22 13:34:51 +02:00
2 changed files with 66 additions and 0 deletions

View File

@ -1534,6 +1534,7 @@ from .voxmedia import (
VoxMediaVolumeIE, VoxMediaVolumeIE,
VoxMediaIE, VoxMediaIE,
) )
from .voe import VOEIE
from .vrt import VRTIE from .vrt import VRTIE
from .vrak import VrakIE from .vrak import VrakIE
from .vrv import ( from .vrv import (

View File

@ -0,0 +1,65 @@
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
int_or_none,
js_to_json,
url_or_none,
)
class VOEIE(InfoExtractor):
IE_NAME = 'voe'
IE_DESC = 'VOE.SX'
_VALID_URL = r'https?://voe\.sx/(e/)?(?P<id>[a-z0-9]+)'
_TEST = {
'url': 'https://voe.sx/e/ng7ja5n5n2y8',
'info_dict': {
'id': 'ng7ja5n5n2y8',
'title': 'md5:a86687fb962742f04652aee19ad34e06',
'thumbnail': r're:^https?://.*\.jpg$',
'ext': 'm3u8',
},
}
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(
'https://voe.sx/e/%s' % video_id, video_id)
sources = self._parse_json(
self._search_regex(r'\bsources\s*=\s*(\{[^}]+\})', webpage, 'sources'),
video_id, transform_source=js_to_json)
title = self._search_regex(
r'<title>(?:Watch\s+)?(?P<title>.+?)(?:-\s+VOE\s+\|.+)?</title>',
webpage, 'title', group='title')
formats = []
f_url = url_or_none(sources.get('hls'))
if f_url:
formats.extend(self._extract_m3u8_formats(
f_url, video_id, entry_protocol='m3u8_native', fatal=False))
f_url = url_or_none(sources.get('mp4'))
if f_url:
formats.append({
'url': f_url,
'ext': 'mp4',
'height': int_or_none(sources.get('video_height')),
})
self._sort_formats(formats)
thumbnail = url_or_none(self._search_regex(
r'(?:VOEPlayer.|data-)poster\s*=\s*(["\'])(?P<thumbnail>(?:(?!\1)\S)+)\1',
webpage, 'thumbnail', group='thumbnail', default=None))
return {
'id': video_id,
'title': title,
'formats': formats,
'thumbnail': thumbnail,
}