From 48f349863d02e389e25663d9bc2e1eaefa17bda9 Mon Sep 17 00:00:00 2001 From: galdwulf Date: Tue, 13 Dec 2016 11:40:08 +0000 Subject: [PATCH 1/3] adding stuffyoushouldknow extractor --- youtube_dl/extractor/stuffyoushouldknow.py | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 youtube_dl/extractor/stuffyoushouldknow.py diff --git a/youtube_dl/extractor/stuffyoushouldknow.py b/youtube_dl/extractor/stuffyoushouldknow.py new file mode 100644 index 000000000..871d1659f --- /dev/null +++ b/youtube_dl/extractor/stuffyoushouldknow.py @@ -0,0 +1,40 @@ +# coding: utf-8 +from __future__ import unicode_literals +from .common import InfoExtractor + +import re + + +class StuffyoushouldknowIE(InfoExtractor): + _VALID_URL = r'https?://?(www).stuffyoushouldknow.com/podcasts/(?P[[a-zA-Z0-9_-]+)' + _TEST = { + 'url': 'http://www.stuffyoushouldknow.com/podcasts/banned-kids-advertising.htm', + 'md5': '12cfeb58e11776addb58ce37c12711b7', + 'info_dict': { + 'title': 'Should Advertising to Kids Be Banned?', + 'url': 'http://www.stuffyoushouldknow.com/podcasts/banned-kids-advertising.htm', + 'site_name': 'Stuff You Should Know', + 'description': 'As kids’ buying power in America has exploded in recent decades, so too has the amount companies spend advertising to them. But because of a quirk of brain development, kids aren’t equipped to understand ads are manipulating them. Should they be banned?', + 'content': 'http://s.hswstatic.com/gif/banned-kids-advertising-sysk.jpg', + }, + + } + + def _real_extract(self, url): + mobj = re.match(self._VALID_URL, url) + video_id=mobj.group('id') + webpage = self._download_webpage(url, video_id) + + video_url = re.search(r'https?://www.podtrac.com/pts/redirect.mp3/podcasts.howstuffworks.com/hsw/podcasts' + r'/sysk/[0-9a-zA-Z_-]*.mp3', webpage) + title = self._og_search_title(webpage) + site_name= self._og_search_title(webpage) + description = self._og_search_description(webpage) + + return { + 'id': video_id, + 'title': title, + 'description': description, + 'site name': site_name, + 'url': video_url.group(0) + } \ No newline at end of file From d22031506915709899c6b8e3a5d6fde69add0b06 Mon Sep 17 00:00:00 2001 From: galdwulf Date: Tue, 13 Dec 2016 11:43:56 +0000 Subject: [PATCH 2/3] adding stuffyoushouldknow extractor --- youtube_dl/extractor/extractors.py | 1 + 1 file changed, 1 insertion(+) diff --git a/youtube_dl/extractor/extractors.py b/youtube_dl/extractor/extractors.py index 2801a380c..5bcadda7b 100644 --- a/youtube_dl/extractor/extractors.py +++ b/youtube_dl/extractor/extractors.py @@ -878,6 +878,7 @@ from .streamcloud import StreamcloudIE from .streamcz import StreamCZIE from .streetvoice import StreetVoiceIE from .sunporno import SunPornoIE +from .stuffyoushouldknow import StuffyoushouldknowIE from .svt import ( SVTIE, SVTPlayIE, From b1317fb7590fa96dd7bd249f9a292b1eb20dffc9 Mon Sep 17 00:00:00 2001 From: galdwulf Date: Thu, 15 Dec 2016 11:14:39 +0000 Subject: [PATCH 3/3] fixing stuffyoushouldknow extractor test case --- youtube_dl/extractor/stuffyoushouldknow.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/youtube_dl/extractor/stuffyoushouldknow.py b/youtube_dl/extractor/stuffyoushouldknow.py index 871d1659f..8d020e5a2 100644 --- a/youtube_dl/extractor/stuffyoushouldknow.py +++ b/youtube_dl/extractor/stuffyoushouldknow.py @@ -9,13 +9,12 @@ class StuffyoushouldknowIE(InfoExtractor): _VALID_URL = r'https?://?(www).stuffyoushouldknow.com/podcasts/(?P[[a-zA-Z0-9_-]+)' _TEST = { 'url': 'http://www.stuffyoushouldknow.com/podcasts/banned-kids-advertising.htm', - 'md5': '12cfeb58e11776addb58ce37c12711b7', + 'md5': 'e128341f40a8be82ac8f55cb0e402d7d', 'info_dict': { + 'id':'banned-kids-advertising', + 'ext':'mp3', 'title': 'Should Advertising to Kids Be Banned?', - 'url': 'http://www.stuffyoushouldknow.com/podcasts/banned-kids-advertising.htm', - 'site_name': 'Stuff You Should Know', 'description': 'As kids’ buying power in America has exploded in recent decades, so too has the amount companies spend advertising to them. But because of a quirk of brain development, kids aren’t equipped to understand ads are manipulating them. Should they be banned?', - 'content': 'http://s.hswstatic.com/gif/banned-kids-advertising-sysk.jpg', }, } @@ -27,14 +26,15 @@ class StuffyoushouldknowIE(InfoExtractor): video_url = re.search(r'https?://www.podtrac.com/pts/redirect.mp3/podcasts.howstuffworks.com/hsw/podcasts' r'/sysk/[0-9a-zA-Z_-]*.mp3', webpage) - title = self._og_search_title(webpage) site_name= self._og_search_title(webpage) description = self._og_search_description(webpage) return { 'id': video_id, - 'title': title, + 'title': site_name, 'description': description, - 'site name': site_name, - 'url': video_url.group(0) + 'url': video_url.group(0), + 'ext': 'mp3', + 'site_name': site_name, + } \ No newline at end of file