1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2025-02-17 01:17:54 +01:00

Fixed formatting according to flake8

This commit is contained in:
Andy Bottom 2018-10-21 14:09:30 -05:00
parent 2d68da7781
commit d76916f79e

View File

@ -6,6 +6,7 @@ from ..utils import (
determine_ext, determine_ext,
) )
class RightNowMediaIE(InfoExtractor): class RightNowMediaIE(InfoExtractor):
IE_NAME = 'rightnowmedia' IE_NAME = 'rightnowmedia'
_VALID_URL = r'https?://(?:www\.)?rightnowmedia\.org/Content/(?P<id>[0-9]+)/(?:downloadAndEmbed)' _VALID_URL = r'https?://(?:www\.)?rightnowmedia\.org/Content/(?P<id>[0-9]+)/(?:downloadAndEmbed)'
@ -21,16 +22,15 @@ class RightNowMediaIE(InfoExtractor):
def _real_extract(self, url): def _real_extract(self, url):
# Video Id # Video Id
video_id = self._match_id(url) video_id = self._match_id(url)
# Download # Download
video_info_dicts = self._download_json( video_info_dicts = self._download_json(
'https://www.rightnowmedia.org/Content/%s/downloadAndEmbed' 'https://www.rightnowmedia.org/Content/%s/downloadAndEmbed'
% video_id, video_id) % video_id, video_id)
# Get All The Formats # Get All The Formats
formats = [] formats = []
for video_info in video_info_dicts['downloadLinks']: for video_info in video_info_dicts['downloadLinks']:
video_url = video_info.get('src')
quality = 'high' if 'HD 1080p' in video_info["QualityName"] else 'low' quality = 'high' if 'HD 1080p' in video_info["QualityName"] else 'low'
formats.append({ formats.append({
'url': video_info["Link"], 'url': video_info["Link"],
@ -38,15 +38,15 @@ class RightNowMediaIE(InfoExtractor):
'format_note': quality, 'format_note': quality,
'format_id': '%s-%s' % (quality, determine_ext(video_info["Link"])), 'format_id': '%s-%s' % (quality, determine_ext(video_info["Link"])),
}) })
# Get the Title # Get the Title
title = compat_urllib_parse_unquote(re.findall( title = compat_urllib_parse_unquote(re.findall(
r'.*?filename=(.*).*(?:.mp4)', r'.*?filename=(.*).*(?:.mp4)',
formats[0]['url'])[0]) formats[0]['url'])[0])
# Sort Formats # Sort Formats
self._sort_formats(formats) self._sort_formats(formats)
# Return # Return
return { return {
'id': video_id, 'id': video_id,
@ -54,7 +54,7 @@ class RightNowMediaIE(InfoExtractor):
'formats': formats, 'formats': formats,
} }
class RightNowMediaPlaylistIE(InfoExtractor): class RightNowMediaPlaylistIE(InfoExtractor):
IE_NAME = 'rightnowmedia:playlist' IE_NAME = 'rightnowmedia:playlist'
_VALID_URL = r'https?://(?:www\.)?rightnowmedia\.org/Content/(?:Series|KidsShow)/(?P<id>[0-9]+)' _VALID_URL = r'https?://(?:www\.)?rightnowmedia\.org/Content/(?:Series|KidsShow)/(?P<id>[0-9]+)'
@ -64,7 +64,7 @@ class RightNowMediaPlaylistIE(InfoExtractor):
'id': '265320' 'id': '265320'
}, },
'playlist_count': 9, 'playlist_count': 9,
},{ }, {
'url': 'https://www.rightnowmedia.org/Content/KidsShow/298875', 'url': 'https://www.rightnowmedia.org/Content/KidsShow/298875',
'info_dict': { 'info_dict': {
'id': '298875' 'id': '298875'
@ -77,18 +77,18 @@ class RightNowMediaPlaylistIE(InfoExtractor):
playlist_id = self._match_id(url) playlist_id = self._match_id(url)
# Download Webpage # Download Webpage
webpage = self._download_webpage(url, playlist_id) webpage = self._download_webpage(url, playlist_id)
# Find The Correct Table # Find The Correct Table
all_buckets = re.findall( all_buckets = re.findall(
r'(?s)<table [^"]*"..*? id="primarySeriesTable" [^"]*"..*? \B.*\B<div class="row rowStripMargin nomobile">', r'(?s)<table [^"]*"..*? id="primarySeriesTable" [^"]*"..*? \B.*\B<div class="row rowStripMargin nomobile">',
webpage) webpage)
# Find All The Video Elements # Find All The Video Elements
all_video_elements = re.findall( all_video_elements = re.findall(
r'.*?data-detail-content-id="(.*)">.*', r'.*?data-detail-content-id="(.*)">.*',
all_buckets[0]) all_buckets[0])
# Finalize All The URLs # Finalize All The URLs
entries = [] entries = []
for video_element in all_video_elements: for video_element in all_video_elements: