]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/sendtonews.py
2 from __future__
import unicode_literals
6 from .jwplatform
import JWPlatformBaseIE
14 class SendtoNewsIE(JWPlatformBaseIE
):
15 _VALID_URL
= r
'https?://embed\.sendtonews\.com/player2/embedplayer\.php\?.*\bSC=(?P<id>[0-9A-Za-z-]+)'
18 # From http://cleveland.cbslocal.com/2016/05/16/indians-score-season-high-15-runs-in-blowout-win-over-reds-rapid-reaction/
19 'url': 'http://embed.sendtonews.com/player2/embedplayer.php?SC=GxfCe0Zo7D-175909-5588&type=single&autoplay=on&sound=YES',
21 'id': 'GxfCe0Zo7D-175909-5588'
24 # test the first video only to prevent lengthy tests
29 'title': 'Recap: CLE 5, LAA 4',
30 'description': '8/14/16: Naquin, Almonte lead Indians in 5-4 win',
32 'thumbnail': 're:https?://.*\.jpg$',
33 'upload_date': '20160815',
34 'timestamp': 1471221961,
39 'skip_download': True,
43 _URL_TEMPLATE
= '//embed.sendtonews.com/player2/embedplayer.php?SC=%s'
46 def _extract_url(cls
, webpage
):
47 mobj
= re
.search(r
'''(?x)<script[^>]+src=([\'"])
48 (?:https?:)?//embed\.sendtonews\.com/player/responsiveembed\.php\?
49 .*\bSC=(?P<SC>[0-9a-zA-Z-]+).*
53 return cls._URL_TEMPLATE % sc
55 def _real_extract(self, url):
56 playlist_id = self._match_id(url)
58 data_url = update_url_query(
59 url.replace('embedplayer.php', 'data_read.php'),
60 {'cmd': 'loadInitial'})
61 playlist_data = self._download_json(data_url, playlist_id)
64 for video in playlist_data['playlistData'][0]:
65 info_dict = self._parse_jwplayer_data(
66 video['jwconfiguration'],
67 require_title=False, rtmp_params={'no_resume': True})
70 if video.get('thumbnailUrl'):
73 'url': video['thumbnailUrl'],
75 if video.get('smThumbnailUrl'):
78 'url': video['smThumbnailUrl'],
81 'title': video['S_headLine'],
82 'description': video.get('S_fullStory'),
83 'thumbnails': thumbnails,
84 'duration': float_or_none(video.get('SM_length')),
85 'timestamp': parse_iso8601(video.get('S_sysDate'), delimiter=' '),
87 entries.append(info_dict)
89 return self.playlist_result(entries, playlist_id)