From 86ee8474119b4043043afd536d98a4b7dc7dc8eb Mon Sep 17 00:00:00 2001 From: mauriziopz Date: Sun, 26 Jun 2016 11:06:31 +0200 Subject: [PATCH] modified url building logic to handle different extensions and videos without and HD format --- youtube_dl/extractor/comingsoon_it.py | 49 ++++++++++++++++++--------- 1 file changed, 33 insertions(+), 16 deletions(-) diff --git a/youtube_dl/extractor/comingsoon_it.py b/youtube_dl/extractor/comingsoon_it.py index d3ed1bb7b..9a57371c3 100644 --- a/youtube_dl/extractor/comingsoon_it.py +++ b/youtube_dl/extractor/comingsoon_it.py @@ -34,31 +34,48 @@ class ComingSoonITIE(InfoExtractor): 'params': { 'format': 'hd', }, + }, + { + 'url': 'http://www.comingsoon.it/film/il-passato-e-una-terra-straniera/39912/video/?vid=1564', + 'md5': '9c8db6b04d4c3858ad31857ce1c82350', + 'info_dict': { + 'id': '1564', + 'ext': 'flv', + 'title': 'Il passato è una terra straniera, Trailer del film diretto da Daniele Vicari, con Elio Germano - Film (2008)', + 'url': 'http://video.comingsoon.it/1564.flv', + 'description': 'Trailer del film diretto da Daniele Vicari, con Elio Germano - Il passato è una terra straniera' + }, + 'params': { + 'format': 'sd', + }, }] def _real_extract(self, url): video_id = self._match_id(url) - webpage = self._download_webpage(url, video_id) - + webpage = self._download_webpage(url, video_id, 'downloading webpage with metadata') title = self._og_search_title(webpage) description = self._og_search_description(webpage) + embedPage = self._download_webpage('http://www.comingsoon.it/videoplayer/embed/?idv=' + video_id, video_id, 'downloading webpage with video urls') + lowRes = self._search_regex(r'vLwRes: "(.*)"', embedPage, 'Low resolution filename', default=None) + highRes = self._search_regex(r'vHiRes: "(.*)"', embedPage, 'High ressolution filename', default=None) + formats = [] + formats.append( + { + 'url': 'http://video.comingsoon.it/' + lowRes, + 'format': 'Standard Definition', + 'format_id': 'sd' + }) + if(lowRes != highRes): + formats.append( + { + 'url': 'http://video.comingsoon.it/' + highRes, + 'format': 'High Definition', + 'format_id': 'hd' + }) return { 'id': video_id, 'title': title, 'description': description, - - 'formats': [ - { - 'url': 'http://video.comingsoon.it/MP4/' + video_id + '.mp4', - 'format': 'Standard Definition', - 'format_id': 'sd' - }, - { - 'url': 'http://video.comingsoon.it/MP4/' + video_id + 'HD.mp4', - 'format': 'High Definition', - 'format_id': 'hd' - } - ], - 'ext': 'mp4' + 'formats': formats, }