[yuvutu] Add new extractor

This commit is contained in:
Simon Morgan 2016-10-07 16:17:57 +01:00
parent 0a33bb2cb2
commit f6199a619d
2 changed files with 47 additions and 0 deletions

View File

@ -1162,6 +1162,7 @@ from .youtube import (
YoutubeUserIE,
YoutubeWatchLaterIE,
)
from .yuvutu import YuvutuIE
from .zapiks import ZapiksIE
from .zdf import ZDFIE, ZDFChannelIE
from .zingmp3 import ZingMp3IE

View File

@ -0,0 +1,46 @@
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import determine_ext
class YuvutuIE(InfoExtractor):
_VALID_URL = r'http://(?:www\.)?yuvutu.com/video/(?P<id>[0-9]+)(?:.*)'
_TEST = {
'url': 'http://www.yuvutu.com/video/330/',
'md5': 'af4a0d2eabec6b6bd43cd6b68543fa9c',
'info_dict': {
'id': '330',
'title': 'carnal bliss',
'ext': 'flv',
'age_limit': 18,
}
}
_title_regex = r"class=[\"']video-title-content[\"']>.+?>(.+?)<"
_thumbnail_regex = r"itemprop=[\"']thumbnailURL[\"']\s+content=[\"'](.+?)[\"']"
_embed_regex = r"[\"'](\/embed_video\.php.+?)[\"']"
_video_regex = r"file:\s*[\"']([^\s]+)[\"']"
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
title = self._html_search_regex(self._title_regex, webpage, 'title')
embed_url = self._html_search_regex(self._embed_regex, webpage,
'embed')
embed_webpage = self._download_webpage(
"http://www.yuvutu.com/" + embed_url, video_id)
video_url = self._html_search_regex(self._video_regex, embed_webpage,
'video_url')
return {
'id': video_id,
'url': video_url,
'ext': determine_ext(video_url, 'mp4'),
'title': title,
'age_limit': 18,
}