From 8d2881a442211b5ea058e7a1f3bfe46359080fd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Kr=C3=BCger?= Date: Thu, 22 Jul 2021 12:46:23 +0200 Subject: [PATCH] [voe] Add new extractor --- youtube_dl/extractor/extractors.py | 1 + youtube_dl/extractor/voe.py | 47 ++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 youtube_dl/extractor/voe.py diff --git a/youtube_dl/extractor/extractors.py b/youtube_dl/extractor/extractors.py index 6e8fc3961..5b658fb1c 100644 --- a/youtube_dl/extractor/extractors.py +++ b/youtube_dl/extractor/extractors.py @@ -1484,6 +1484,7 @@ from .voxmedia import ( VoxMediaVolumeIE, VoxMediaIE, ) +from .voe import VOEIE from .vrt import VRTIE from .vrak import VrakIE from .vrv import ( diff --git a/youtube_dl/extractor/voe.py b/youtube_dl/extractor/voe.py new file mode 100644 index 000000000..4f24e50bb --- /dev/null +++ b/youtube_dl/extractor/voe.py @@ -0,0 +1,47 @@ +# coding: utf-8 +from __future__ import unicode_literals + +from .common import InfoExtractor + + +class VOEIE(InfoExtractor): + IE_NAME = 'voe' + IE_DESC = 'VOE.SX' + _VALID_URL = r'https?://voe\.sx/(e/)?(?P[a-z0-9]+)' + _TEST = { + 'url': 'https://voe.sx/e/ng7ja5n5n2y8', + 'info_dict': { + 'id': 'ng7ja5n5n2y8', + 'title': 'md5:05ab15eb43a32f0f5918755156c5fb34', + '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) + + m3u8 = self._search_regex( + r'(https.+m3u8)', + webpage, 'm3u8') + + title = self._search_regex( + r'Watch (?P<title>.+)<\/title>', + webpage, 'title', group='title') + + thumbnail = self._search_regex( + r'VOEPlayer.poster="(?P<thumbnail>https.+)"', + webpage, 'thumbnail', group='thumbnail') + + formats = self._extract_m3u8_formats(m3u8, video_id) + self._sort_formats(formats) + + return { + 'id': video_id, + 'title': title, + 'formats': formats, + 'thumbnail': thumbnail, + }