# 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, }