mirror of
https://github.com/l1ving/youtube-dl
synced 2020-11-18 19:53:54 -08:00
Finalized and tested rightnowmedia for the trailers.
This commit is contained in:
parent
f65e62f00e
commit
2d68da7781
@ -929,7 +929,10 @@ from .revision3 import (
|
||||
Revision3IE,
|
||||
)
|
||||
from .rice import RICEIE
|
||||
from .rightnowmedia import RightNowMediaIE
|
||||
from .rightnowmedia import (
|
||||
RightNowMediaIE,
|
||||
RightNowMediaPlaylistIE
|
||||
)
|
||||
from .rmcdecouverte import RMCDecouverteIE
|
||||
from .ro220 import Ro220IE
|
||||
from .rockstargames import RockstarGamesIE
|
||||
|
@ -1,38 +1,34 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import re
|
||||
from ..compat import compat_urllib_parse_unquote
|
||||
from .common import InfoExtractor
|
||||
from ..utils import (
|
||||
determine_ext
|
||||
determine_ext,
|
||||
)
|
||||
|
||||
class RightNowMediaIE(InfoExtractor):
|
||||
_VALID_URL = r'https?://(?:www\.)?rightnowmedia\.org/Content/(?:VideoElement|Series|KidsShow)/(?P<id>[0-9]+)'
|
||||
IE_NAME = 'rightnowmedia'
|
||||
_VALID_URL = r'https?://(?:www\.)?rightnowmedia\.org/Content/(?P<id>[0-9]+)/(?:downloadAndEmbed)'
|
||||
_TEST = {
|
||||
'url': 'https://www.rightnowmedia.org/Content/VideoElement/231113',
|
||||
'url': 'https://www.rightnowmedia.org/Content/293653/downloadAndEmbed',
|
||||
'info_dict': {
|
||||
'id': '231113',
|
||||
'id': '293653',
|
||||
'ext': 'mp4',
|
||||
'title': 'Augustana (S.D.) Baseball vs University of Mary',
|
||||
'description': 'md5:7578478614aae3bdd4a90f578f787438',
|
||||
'timestamp': 1490468400,
|
||||
'upload_date': '20170325',
|
||||
'title': ' Philippians 1_12-18 - HD 1080p',
|
||||
}
|
||||
}
|
||||
|
||||
def _real_extract(self, url):
|
||||
|
||||
# Video Id
|
||||
video_id = self._match_id(url)
|
||||
|
||||
# Download
|
||||
video_info_dicts = self._download_json(
|
||||
'https://www.rightnowmedia.org/Content/%s/downloadAndEmbed'
|
||||
% video_id, video_id)
|
||||
|
||||
video_url = 'https://%s' % video_info_dicts['downloadLinks']
|
||||
|
||||
# Get All The Formats
|
||||
formats = []
|
||||
|
||||
|
||||
|
||||
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'
|
||||
@ -42,14 +38,65 @@ class RightNowMediaIE(InfoExtractor):
|
||||
'format_note': quality,
|
||||
'format_id': '%s-%s' % (quality, determine_ext(video_info["Link"])),
|
||||
})
|
||||
|
||||
# Get the Title
|
||||
title = compat_urllib_parse_unquote(re.findall(
|
||||
r'.*?filename=(.*).*(?:.mp4)',
|
||||
formats[0]['url'])[0])
|
||||
|
||||
# Sort Formats
|
||||
self._sort_formats(formats)
|
||||
|
||||
title = "Test 01"
|
||||
description = "aaaa"
|
||||
|
||||
|
||||
# Return
|
||||
return {
|
||||
'id': video_id,
|
||||
'title': title,
|
||||
'description': description,
|
||||
'formats': formats,
|
||||
}
|
||||
|
||||
|
||||
class RightNowMediaPlaylistIE(InfoExtractor):
|
||||
IE_NAME = 'rightnowmedia:playlist'
|
||||
_VALID_URL = r'https?://(?:www\.)?rightnowmedia\.org/Content/(?:Series|KidsShow)/(?P<id>[0-9]+)'
|
||||
_TESTS = [{
|
||||
'url': 'https://www.rightnowmedia.org/Content/Series/265320',
|
||||
'info_dict': {
|
||||
'id': '265320'
|
||||
},
|
||||
'playlist_count': 9,
|
||||
},{
|
||||
'url': 'https://www.rightnowmedia.org/Content/KidsShow/298875',
|
||||
'info_dict': {
|
||||
'id': '298875'
|
||||
},
|
||||
'playlist_count': 15,
|
||||
}]
|
||||
|
||||
def _real_extract(self, url):
|
||||
# Series Id
|
||||
playlist_id = self._match_id(url)
|
||||
|
||||
# Download Webpage
|
||||
webpage = self._download_webpage(url, playlist_id)
|
||||
|
||||
# Find The Correct Table
|
||||
all_buckets = re.findall(
|
||||
r'(?s)<table [^"]*"..*? id="primarySeriesTable" [^"]*"..*? \B.*\B<div class="row rowStripMargin nomobile">',
|
||||
webpage)
|
||||
|
||||
# Find All The Video Elements
|
||||
all_video_elements = re.findall(
|
||||
r'.*?data-detail-content-id="(.*)">.*',
|
||||
all_buckets[0])
|
||||
|
||||
# Finalize All The URLs
|
||||
entries = []
|
||||
for video_element in all_video_elements:
|
||||
entries.append(self.url_result('https://www.rightnowmedia.org/Content/%s/downloadAndEmbed' % video_element))
|
||||
|
||||
# Return
|
||||
return {
|
||||
'_type': 'playlist',
|
||||
'id': playlist_id,
|
||||
'entries': entries,
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user