From c88b78f43e66c6fe6729e640898e66099b136e7d Mon Sep 17 00:00:00 2001 From: bake Date: Sun, 6 Sep 2015 02:42:58 +0200 Subject: [PATCH] [filehoot] Add new extractor --- youtube_dl/extractor/__init__.py | 1 + youtube_dl/extractor/filehoot.py | 54 ++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 youtube_dl/extractor/filehoot.py diff --git a/youtube_dl/extractor/__init__.py b/youtube_dl/extractor/__init__.py index 5d2ea39d0..47515a5a3 100644 --- a/youtube_dl/extractor/__init__.py +++ b/youtube_dl/extractor/__init__.py @@ -166,6 +166,7 @@ from .extremetube import ExtremeTubeIE from .facebook import FacebookIE from .faz import FazIE from .fc2 import FC2IE +from .filehoot import FilehootIE from .firstpost import FirstpostIE from .firsttv import FirstTVIE from .fivemin import FiveMinIE diff --git a/youtube_dl/extractor/filehoot.py b/youtube_dl/extractor/filehoot.py new file mode 100644 index 000000000..4eadcae71 --- /dev/null +++ b/youtube_dl/extractor/filehoot.py @@ -0,0 +1,54 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re + +from .common import InfoExtractor +from ..compat import ( + compat_urllib_parse, + compat_urllib_request, +) + + +class FilehootIE(InfoExtractor): + IE_NAME = 'filehoot.com' + _VALID_URL = r'https?://filehoot\.com/(?P[a-zA-Z0-9_-]+)(\.html)?' + + _TEST = { + 'url': 'http://filehoot.com/3ivfabn7573c.html', + 'info_dict': { + 'id': '3ivfabn7573c', + 'ext': 'mp4', + 'title': 'youtube-dl test video \'äBaW_jenozKc.mp4.mp4' + } + } + + def _real_extract(self, url): + video_id = self._match_id(url) + url = 'http://filehoot.com/%s' % video_id + + orig_webpage = self._download_webpage(url, video_id) + + fields = re.findall(r'''(?x)]*>([^<]+)<', webpage, 'title') + video_url = self._search_regex(r'file:\s*"([^"]+)"', webpage, 'video URL') + thumbnail = self._search_regex(r'image:\s*"([^"]+)"', webpage, 'thumbnail URL', fatal=False) + + return { + 'id': video_id, + 'title': title, + 'url': video_url, + 'thumbnail': thumbnail, + }