From 42d7e1605383093f9ee66f63cbc55b551b8ee297 Mon Sep 17 00:00:00 2001 From: sprhawk <465558+sprhawk@users.noreply.github.com> Date: Mon, 25 Mar 2019 23:01:07 +0800 Subject: [PATCH] added simple download from 360elib --- youtube_dl/extractor/elib360.py | 47 ++++++++++++++++++++++++++++++ youtube_dl/extractor/extractors.py | 1 + 2 files changed, 48 insertions(+) create mode 100644 youtube_dl/extractor/elib360.py diff --git a/youtube_dl/extractor/elib360.py b/youtube_dl/extractor/elib360.py new file mode 100644 index 000000000..9654c1b85 --- /dev/null +++ b/youtube_dl/extractor/elib360.py @@ -0,0 +1,47 @@ +# coding: utf-8 +from __future__ import unicode_literals + +from .common import InfoExtractor +from ..compat import ( + compat_str, +) +import re + + +class Elib360IE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?360elib\.com:2029/Details.aspx\?voiceid=(?P[0-9]+)&childid=(?P[0-9]+)' + _TEST = { + 'url': 'http://www.360elib.com:2029/Details.aspx?voiceid=10732&childid=617839###', + 'md5': '0e5d06001e72fdc44b008bee0735d5f7', + 'info_dict': { + 'id': '10732_617839', + 'ext': 'm4a', + 'title': '明朝那些事儿03', + 'description': '明朝那些事儿03', + } + } + + @classmethod + def _match_group(cls, group, url): + m = cls._VALID_URL_RE.match(url) + assert m + return compat_str(m.group(group)) + + def _real_extract(self, url): + voice_id = self._match_group("voc_id", url) + child_id = self._match_group("cld_id", url) + video_id = voice_id + "_" + child_id + webpage = self._download_webpage(url, video_id) + print(webpage) + src = self._search_regex(r']+src=[\'"]([^"]+?)[\'"][^>]*?>', webpage, 'src', fatal=False, flags=re.UNICODE) + + title = self._search_regex(r']+id=[\'"]ctl00_ContentPlaceHolder1_lb_childname[\'"][^>]*?>([^<]+)', webpage, 'title', fatal=False, flags=re.UNICODE) + title = title.strip() + return { + 'id': video_id, + 'title': title, + 'description': title, + 'formats': [{ + 'url': "http://www.360elib.com:2029" + src + }] + } diff --git a/youtube_dl/extractor/extractors.py b/youtube_dl/extractor/extractors.py index f32f22a5a..03a7fcd75 100644 --- a/youtube_dl/extractor/extractors.py +++ b/youtube_dl/extractor/extractors.py @@ -326,6 +326,7 @@ from .ellentube import ( EllenTubeVideoIE, EllenTubePlaylistIE, ) +from .elib360 import Elib360IE from .elpais import ElPaisIE from .embedly import EmbedlyIE from .engadget import EngadgetIE