diff options
| author | Sergey M․ <dstftw@gmail.com> | 2015-08-08 04:00:52 +0600 | 
|---|---|---|
| committer | Sergey M․ <dstftw@gmail.com> | 2015-08-08 04:00:52 +0600 | 
| commit | 621d6a9516e0f9cd8c45e12904f4d4b7615e7fb8 (patch) | |
| tree | 06150f3503519b7799eeec44dca655b75a824830 | |
| parent | 3550821fb4ca2f0e47542a7fa16b6543b06df724 (diff) | |
[periscope] Switch to API for broadcast data
| -rw-r--r-- | youtube_dl/extractor/periscope.py | 20 | 
1 files changed, 8 insertions, 12 deletions
| diff --git a/youtube_dl/extractor/periscope.py b/youtube_dl/extractor/periscope.py index 5219e1a75..11648a511 100644 --- a/youtube_dl/extractor/periscope.py +++ b/youtube_dl/extractor/periscope.py @@ -25,21 +25,17 @@ class PeriscopeIE(InfoExtractor):          'skip': 'Expires in 24 hours',      } -    def _real_extract(self, url): -        video_id = self._match_id(url) +    def _call_api(self, method, token): +        return self._download_json( +            'https://api.periscope.tv/api/v2/%s?token=%s' % (method, token), token) -        replay = self._download_json( -            'https://api.periscope.tv/api/v2/getAccessPublic?token=%s' % video_id, video_id) +    def _real_extract(self, url): +        token = self._match_id(url) +        replay = self._call_api('getAccessPublic', token)          video_url = replay['replay_url'] -        webpage = self._download_webpage(url, video_id) - -        broadcast_data = self._parse_json( -            unescapeHTML(self._html_search_meta( -                'broadcast-data', webpage, 'broadcast data', fatal=True)), -            video_id) - +        broadcast_data = self._call_api('getBroadcastPublic', token)          broadcast = broadcast_data['broadcast']          status = broadcast['status'] @@ -54,7 +50,7 @@ class PeriscopeIE(InfoExtractor):          } for image in ('image_url', 'image_url_small') if broadcast.get(image)]          return { -            'id': broadcast.get('id') or video_id, +            'id': broadcast.get('id') or token,              'url': video_url,              'ext': 'mp4',              'protocol': 'm3u8_native', | 
