From 6d6a00c8e5b3a9e3984960a26a42baf26cbcad0d Mon Sep 17 00:00:00 2001 From: yash Date: Mon, 6 Apr 2020 20:20:10 -0700 Subject: [PATCH] [yjc] Add new extractor --- youtube_dl/extractor/extractors.py | 1 + youtube_dl/extractor/yjc.py | 32 ++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 youtube_dl/extractor/yjc.py diff --git a/youtube_dl/extractor/extractors.py b/youtube_dl/extractor/extractors.py index e407ab3d992..f34702c5351 100644 --- a/youtube_dl/extractor/extractors.py +++ b/youtube_dl/extractor/extractors.py @@ -1449,6 +1449,7 @@ from .yapfiles import YapFilesIE from .yesjapan import YesJapanIE from .yinyuetai import YinYueTaiIE +from .yjc import yjcIE from .ynet import YnetIE from .youjizz import YouJizzIE from .youku import ( diff --git a/youtube_dl/extractor/yjc.py b/youtube_dl/extractor/yjc.py new file mode 100644 index 00000000000..922d2ab626e --- /dev/null +++ b/youtube_dl/extractor/yjc.py @@ -0,0 +1,32 @@ +from __future__ import unicode_literals + +from .common import InfoExtractor + + +class yjcIE(InfoExtractor): + _VALID_URL = r'(?:https?://)?(?:www\.)?yjc\.ir/fa/news/(?P\w+)/*' + + _TESTS = { + # TODO: Implement + } + + def _real_extract(self, url): + video_id = self._match_id(url) + + webpage = self._download_webpage( + url, video_id + ) + + title = self._html_search_regex(r'(.+?)', webpage, 'title') + + download_url = self._html_search_regex( + + r'((https:\/\/)cdn\.yjc\.ir/files/fa/news/[0-9]*/[0-9]*/[0-9]*/[0-9_]*\.mp4)', + + webpage, "download_url" + ) + return { + 'id': video_id, + 'url': download_url, + 'title': title + }