homemoviestube extractor in working state

This commit is contained in:
steve 2018-11-03 23:09:43 -04:00
parent fe1010df3d
commit 9317b8c65d

View File

@ -1,38 +1,39 @@
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
class HomeMoviesTubeIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?homemoviestube\.com/watch/(?P<id>[0-9]+)'
_VALID_URL = r'https?://(?:www\.)?homemoviestube\.com/videos/(?P<id>[0-9]+)/(?P<display_id>[^/]+)\.html'
_TEST = {
'url': 'https://homemoviestube.com/watch/42',
'md5': 'TODO: md5 sum of the first 10241 bytes of the video file (use --test)',
'url': 'https://www.homemoviestube.com/videos/314747/creamed-again.html',
'md5': 'a1f827520d82c0b70da391a8aed410c9',
'info_dict': {
'id': '42',
'id': '314747',
'display_id': 'creamed-again',
'ext': 'mp4',
'title': 'Video title goes here',
'thumbnail': r're:^https?://.*\.jpg$',
# TODO more properties, either as:
# * A value
# * MD5 checksum; start the string with md5:
# * A regular expression; start the string with re:
# * Any Python type (for example int or float)
'title': 'Creamed again',
}
}
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
mobj = re.match(self._VALID_URL, url)
display_id = mobj.group('display_id')
video_id = mobj.group('id')
webpage = self._download_webpage(url, display_id)
video_url = self._html_search_regex(
r'<source src="(.+?)"', webpage, 'video URL')
# TODO more code goes here, for example ...
title = self._html_search_regex(r'<h1>(.+?)</h1>', webpage, 'title')
return {
'id': video_id,
'display_id': display_id,
'title': title,
'description': self._og_search_description(webpage),
'uploader': self._search_regex(r'<div[^>]+id="uploader"[^>]*>([^<]+)<', webpage, 'uploader', fatal=False),
# TODO more properties (see youtube_dl/extractor/common.py)
'url': video_url,
}