1
0
mirror of https://github.com/ytdl-org/youtube-dl.git synced 2025-02-12 05:00:11 +00:00

[BrainPOP] Clean up code and account for non-mandatory fields

This commit is contained in:
Nehal Patel 2016-07-06 23:53:10 -05:00
parent 45abe2051d
commit f56a9dbdbc

View File

@ -24,19 +24,19 @@ class BrainPOPIE(InfoExtractor):
self.report_extraction(video_id) self.report_extraction(video_id)
ec_token = self._html_search_regex(r'ec_token : \'(.+)\'', webpage, "token") ec_token = self._html_search_regex(r'ec_token : \'(.+)\'', webpage, 'token')
movie_cdn_path = self._html_search_regex(r'movie_cdn_path : \'(.+)\'', webpage, "cdn path") movie_cdn_path = self._html_search_regex(r'movie_cdn_path : \'(.+)\'', webpage, 'cdn path')
mp4 = self._html_search_regex(r'mp4":"([^"]*)', webpage, "mp4") mp4 = self._html_search_regex(r'mp4":"([^"]*)', webpage, 'mp4')
url = movie_cdn_path + mp4.replace("\\", "") + "?" + ec_token url = movie_cdn_path + mp4.replace('\\', '') + '?' + ec_token
title = self._html_search_regex(r'type":"Movie","name":"([^"]*)"', webpage, "title") title = self._html_search_regex(r'type":"Movie","name":"([^"]*)"', webpage, 'title') or self._html_search_regex(r'<title>(.+?)</title>', webpage, 'title')
thumbnail_cdn = self._html_search_regex(r"'cdn_path' : '([^']*)'", webpage, "thumbnail cdn") thumbnail_cdn = self._html_search_regex(r"'cdn_path' : '([^']*)'", webpage, 'thumbnail cdn', fatal=False)
thumbnail_image = self._html_search_regex(r'type":"Movie","name":"[^"]*","image":"([^"]*)"', webpage, "thumbnail") thumbnail_image = self._html_search_regex(r'type":"Movie","name":"[^"]*","image":"([^"]*)"', webpage, 'thumbnail', fatal=False)
thumbnail = thumbnail_cdn + thumbnail_image.replace("\\", "") thumbnail = thumbnail_cdn + thumbnail_image.replace('\\', '')
description = self._html_search_regex(r'type":"Movie","name":"[^"]*","image":"[^"]*","description":"([^"]*)"', webpage, "description") description = self._html_search_regex(r'type":"Movie","name":"[^"]*","image":"[^"]*","description":"([^"]*)"', webpage, 'description', fatal=False)
return { return {
'id': video_id, 'id': video_id,