diff --git a/kMjlhMWE5OT.unknown_video b/kMjlhMWE5OT.unknown_video new file mode 100644 index 000000000..9cc4f399b Binary files /dev/null and b/kMjlhMWE5OT.unknown_video differ diff --git a/youtube_dl/extractor/genvideos.py b/youtube_dl/extractor/genvideos.py index 0ba035eda..74a2e973a 100644 --- a/youtube_dl/extractor/genvideos.py +++ b/youtube_dl/extractor/genvideos.py @@ -5,6 +5,7 @@ from .common import InfoExtractor import requests import json +import urllib from urlparse import parse_qs, urlparse @@ -16,7 +17,7 @@ class GenVideosIE(InfoExtractor): # * http://genvideos.org/watch_kMjlhMWE5OT.html#video=tBa-Q-WkbPqwzs34b7ArqU7VomQMb2n-RAlARWKWKTI _TEST = { 'url': 'http://genvideos.org/watch?v=kMjlhMWE5OT', - 'md5': 'TODO: md5 sum of the first 10241 bytes of the video file (use --test)', + #'md5': 'TODO: md5 sum of the first 10241 bytes of the video file (use --test)', 'info_dict': { 'id': 'kMjlhMWE5OT', 'ext': 'mp4', @@ -35,6 +36,7 @@ class GenVideosIE(InfoExtractor): webpage = self._download_webpage(url, video_id) title = self._html_search_regex(r'

(.+?)

', webpage, 'title') + print("Title - " + title) #TODO retrieve video url urls_data = requests.post( "https://genvideos.org/video_info/iframe", @@ -42,17 +44,18 @@ class GenVideosIE(InfoExtractor): headers={'referer': 'https://genvideos.org/'} ) #returns json containing the url of the video (in 360p, 720p and 1080p). #For example - {"360":"\/\/html5player.org\/embed?url=https%3A%2F%2Flh3.googleusercontent.com%2FW6-SNGaDLWNyucD3pMqa1uMBapGDbtMTOtwpXrEu-w%3Dm18","720":"\/\/html5player.org\/embed?url=https%3A%2F%2Flh3.googleusercontent.com%2FW6-SNGaDLWNyucD3pMqa1uMBapGDbtMTOtwpXrEu-w%3Dm22","1080":"\/\/html5player.org\/embed?url=https%3A%2F%2Flh3.googleusercontent.com%2FW6-SNGaDLWNyucD3pMqa1uMBapGDbtMTOtwpXrEu-w%3Dm37"} - urls_data_json = json.loads(r.text) - _360p_url = parse_qs(urlparse(urls_data_json['360']).query)['url'] + urls_data_json = json.loads(urls_data.text) + _360p_redirect_url = parse_qs(urlparse(urls_data_json['360']).query)['url'][0] + _360p_url = urllib.urlopen(_360p_redirect_url).geturl() # TODO : return all possible formats instead of just 360p return { 'id': video_id, 'title': title, - 'url': _360p_url + 'url': _360p_url, + 'ext': 'mp4' #'description': self._og_search_description(webpage), #'uploader': self._search_regex(r']+id="uploader"[^>]*>([^<]+)<', webpage, 'uploader', fatal=False), # TODO more properties (see youtube_dl/extractor/common.py) } - \ No newline at end of file