3 from .common
import InfoExtractor
14 class SendtoNewsIE(InfoExtractor
):
16 _VALID_URL
= r
'https?://embed\.sendtonews\.com/player2/embedplayer\.php\?.*\bSC=(?P<id>[0-9A-Za-z-]+)'
19 # From http://cleveland.cbslocal.com/2016/05/16/indians-score-season-high-15-runs-in-blowout-win-over-reds-rapid-reaction/
20 'url': 'http://embed.sendtonews.com/player2/embedplayer.php?SC=GxfCe0Zo7D-175909-5588&type=single&autoplay=on&sound=YES',
22 'id': 'GxfCe0Zo7D-175909-5588',
25 # test the first video only to prevent lengthy tests
30 'title': 'Indians introduce Encarnacion',
31 'description': 'Indians president of baseball operations Chris Antonetti and Edwin Encarnacion discuss the slugger\'s three-year contract with Cleveland',
33 'thumbnail': r
're:https?://.*\.jpg$',
34 'upload_date': '20170105',
35 'timestamp': 1483649762,
40 'skip_download': True,
44 _URL_TEMPLATE
= '//embed.sendtonews.com/player2/embedplayer.php?SC=%s'
47 def _extract_embed_urls(cls
, url
, webpage
):
48 mobj
= re
.search(r
'''(?x)<script[^>]+src=([\'"])
49 (?:https?:)?//embed\.sendtonews\.com/player/responsiveembed\.php\?
50 .*\bSC=(?P<SC>[0-9a-zA-Z-]+).*
54 yield cls._URL_TEMPLATE % sc
56 def _real_extract(self, url):
57 playlist_id = self._match_id(url)
59 data_url = update_url_query(
60 url.replace('embedplayer.php', 'data_read.php'),
61 {'cmd': 'loadInitial'})
62 playlist_data = self._download_json(data_url, playlist_id)
65 for video in playlist_data['playlistData'][0]:
66 info_dict = self._parse_jwplayer_data(
67 video['jwconfiguration'],
68 require_title=False, m3u8_id='hls', rtmp_params={'no_resume': True})
70 for f in info_dict['formats']:
73 tbr = int_or_none(self._search_regex(
74 r'/(\d+)k/', f['url'], 'bitrate', default=None))
78 'format_id': f'{determine_protocol(f)}-{tbr}',
83 if video.get('thumbnailUrl'):
86 'url': video['thumbnailUrl'],
88 if video.get('smThumbnailUrl'):
91 'url': video['smThumbnailUrl'],
94 'title': video['S_headLine'].strip(),
95 'description': unescapeHTML(video.get('S_fullStory')),
96 'thumbnails': thumbnails,
97 'duration': float_or_none(video.get('SM_length')),
98 'timestamp': parse_iso8601(video.get('S_sysDate'), delimiter=' '),
99 # 'tbr' was explicitly set to be preferred over 'height' originally,
100 # So this is being kept unless someone can confirm this is unnecessary
101 '_format_sort_fields': ('tbr', 'res'),
103 entries.append(info_dict)
105 return self.playlist_result(entries, playlist_id)