From 7736df2fbfe098dd4abcab7dcc12f25364182b76 Mon Sep 17 00:00:00 2001 From: TRox1972 Date: Fri, 20 May 2016 03:16:10 +0200 Subject: [PATCH] [Favour.me] Add new extractor --- youtube_dl/extractor/extractors.py | 1 + youtube_dl/extractor/favourme.py | 42 ++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 youtube_dl/extractor/favourme.py diff --git a/youtube_dl/extractor/extractors.py b/youtube_dl/extractor/extractors.py index 04cd23bdb..dd9ec86a6 100644 --- a/youtube_dl/extractor/extractors.py +++ b/youtube_dl/extractor/extractors.py @@ -259,6 +259,7 @@ from .expotv import ExpoTVIE from .extremetube import ExtremeTubeIE from .eyedotv import EyedoTVIE from .facebook import FacebookIE +from .favourme import FavourMeIE from .faz import FazIE from .fc2 import FC2IE from .fczenit import FczenitIE diff --git a/youtube_dl/extractor/favourme.py b/youtube_dl/extractor/favourme.py new file mode 100644 index 000000000..3164d764c --- /dev/null +++ b/youtube_dl/extractor/favourme.py @@ -0,0 +1,42 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re +from .common import InfoExtractor + + +class FavourMeIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?(?:favour\.me|likeafool\.com)/video/(?P\d{5})/(?P[^/?]+)' + _TESTS = [{ + 'url': 'http://www.favour.me/video/13814/this-mom039s-experiment-proves-that-bottled-water-is-not-as-quothealthyquot-as-it-claims', + 'md5': '44f1421a365637a6c3d4f0c2f5b60df8', + 'info_dict': { + 'id': '13814', + 'title': 'This Mom\'s Experiment Proves That Bottled Water Is Not As "Healthy" As It Claims', + 'ext': 'mp4', + 'uploader': 'www.favour.me', + } + }, { + 'url': 'http://www.likeafool.com/video/13799/moose-unexpectedly-gives-birth-to-twins', + 'md5': '5b775f8d51dcc227e9a25a9448bfb2d1', + 'info_dict': { + 'id': '13799', + 'title': 'Moose Unexpectedly Gives Birth To Twins', + 'ext': 'mp4', + 'uploader': 'www.likeafool.com', + } + }] + + def _real_extract(self, url): + video_id, display_id = re.match(self._VALID_URL, url).groups() + + webpage = self._download_webpage(url, display_id) + iframe_url = self._search_regex(r']+src="([^">]+)"', webpage, 'iframe URL') + + return { + '_type': 'url_transparent', + 'id': video_id, + 'display_id': display_id, + 'url': iframe_url, + 'title': self._html_search_regex(r'(.+)\s+\|.+', webpage, 'title'), + }