From 5e5a8359629af38e2c62907cc823a164695366b1 Mon Sep 17 00:00:00 2001 From: kopalniadolow Date: Fri, 8 Sep 2017 17:09:32 +0200 Subject: [PATCH] [TOKFM] Add new extractor --- youtube_dl/extractor/extractors.py | 1 + youtube_dl/extractor/tokfm.py | 33 ++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 youtube_dl/extractor/tokfm.py diff --git a/youtube_dl/extractor/extractors.py b/youtube_dl/extractor/extractors.py index 46a11f3ef..d86502b1b 100644 --- a/youtube_dl/extractor/extractors.py +++ b/youtube_dl/extractor/extractors.py @@ -1048,6 +1048,7 @@ from .tnaflix import ( MovieFapIE, ) from .toggle import ToggleIE +from .tokfm import TOKFMIE from .tonline import TOnlineIE from .toongoggles import ToonGogglesIE from .toutv import TouTvIE diff --git a/youtube_dl/extractor/tokfm.py b/youtube_dl/extractor/tokfm.py new file mode 100644 index 000000000..c068bec17 --- /dev/null +++ b/youtube_dl/extractor/tokfm.py @@ -0,0 +1,33 @@ +# coding: utf-8 +from __future__ import unicode_literals + +from .common import InfoExtractor + + +class TOKFMIE(InfoExtractor): + _VALID_URL = r'https?://audycje\.tokfm\.pl/podcast/[^/]+/(?P[0-9]+)' + _TEST = { + 'url': 'http://audycje.tokfm.pl/podcast/Dr-Irena-Ozog-dr-Boguslaw-Grabowski-i-prof-Michal-Brzezinski/52972', + 'md5': '2047ca2976c616d18f8618946b62c3ed', + 'info_dict': { + 'id': '52972', + 'ext': 'mp3', + 'title': 'Dr Irena Ożóg, dr Bogusław Grabowski i prof. Michał Brzeziński', + 'description': 'Czy wróciły inwestycje? Jakie perspektywy dla wzrostu PKB?' + } + } + + def _real_extract(self, url): + video_id = self._match_id(url) + webpage = self._download_webpage(url, video_id) + # TODO more code goes here, for example ... + title = self._html_search_regex(r'

(.+?)

', webpage, 'title') + description = self._html_search_regex(r'
(.+?)
', webpage, None) + js = self._download_json('http://audycje.tokfm.pl/gets', video_id, data='{"pid": %s, "st": "tokfm"}' % video_id) + return { + 'id': video_id, + 'title': title, + 'description': description, + 'url': js['url'] + # TODO more properties (see youtube_dl/extractor/common.py) + }