download all pages before start extracting info

This commit is contained in:
remitamine 2015-06-27 10:55:25 +01:00
parent 7d7d469025
commit f39eb98bab

View File

@ -34,7 +34,6 @@ def _real_extract(self, url):
display_id, video_id = match(self._VALID_URL,url).groups() display_id, video_id = match(self._VALID_URL,url).groups()
if display_id is None: if display_id is None:
embed_webpage = self._download_webpage('http://www.snagfilms.com/embed/player?filmId=' + video_id, video_id) embed_webpage = self._download_webpage('http://www.snagfilms.com/embed/player?filmId=' + video_id, video_id)
display_id = self._html_search_regex( display_id = self._html_search_regex(
r"snagfilms\.com/films/title/(?P<display_id>.+?)(?:/|')", r"snagfilms\.com/films/title/(?P<display_id>.+?)(?:/|')",
embed_webpage, embed_webpage,
@ -48,16 +47,16 @@ def _real_extract(self, url):
'data' 'data'
), display_id) ), display_id)
if video_id is None:
video_id = json_data['id']
embed_webpage = self._download_webpage('http://www.snagfilms.com/embed/player?filmId=' + video_id, video_id)
title = json_data['title'] title = json_data['title']
duration = int(json_data['duration']) duration = int(json_data['duration'])
description = json_data['synopsis'] description = json_data['synopsis']
categories = [category['title'] for category in json_data['categories']] categories = [category['title'] for category in json_data['categories']]
thumbnail = json_data['image'] thumbnail = json_data['image']
if video_id is None:
video_id = json_data['id']
embed_webpage = self._download_webpage('http://www.snagfilms.com/embed/player?filmId=' + video_id, video_id)
sources = self._parse_json(js_to_json(self._html_search_regex( sources = self._parse_json(js_to_json(self._html_search_regex(
r'sources: (?P<sources>\[.*?\])', r'sources: (?P<sources>\[.*?\])',
embed_webpage, embed_webpage,