2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
13 class PokerGoBaseIE(InfoExtractor
):
14 _NETRC_MACHINE
= 'pokergo'
16 _PROPERTY_ID
= '1dfb3940-7d53-4980-b0b0-f28b369a000d'
18 def _perform_login(self
, username
, password
):
22 PokerGoBaseIE
._AUTH
_TOKEN
= self
._download
_json
(
23 f
'https://subscription.pokergo.com/properties/{self._PROPERTY_ID}/sign-in', None,
24 headers
={'authorization': f'Basic {base64.b64encode(f"{username}
:{password}
".encode()).decode()}'},
25 data=b'')['meta']['token']
26 if not self._AUTH_TOKEN:
27 raise ExtractorError('Unable to get Auth Token.', expected=True)
29 def _real_initialize(self):
30 if not self._AUTH_TOKEN:
31 self.raise_login_required(method='password')
34 class PokerGoIE(PokerGoBaseIE):
35 _VALID_URL = r'https?://(?:www\.)?pokergo\.com/videos/(?P<id>[^&$#/?]+)'
38 'url': 'https://www.pokergo.com/videos/2a70ec4e-4a80-414b-97ec-725d9b72a7dc',
42 'title': 'Poker After Dark | Season 12 (2020) | Cry Me a River | Episode 2',
43 'description': 'md5:c7a8c29556cbfb6eb3c0d5d622251b71',
44 'thumbnail': 'https://cdn.jwplayer.com/v2/media/aVLOxDzY/poster.jpg?width=720',
45 'timestamp': 1608085715,
49 'series': 'poker after dark',
50 'upload_date': '20201216',
51 'season': 'Season 12',
52 'episode': 'Episode 2',
53 'display_id': '2a70ec4e-4a80-414b-97ec-725d9b72a7dc',
55 'params': {'skip_download': True}
58 def _real_extract(self, url):
59 id = self._match_id(url)
60 data_json = self._download_json(f'https://api.pokergo.com/v2/properties/{self._PROPERTY_ID}/videos/{id}', id,
61 headers={'authorization': f'Bearer {self._AUTH_TOKEN}'})['data']
62 v_id = data_json['source']
66 'id': image.get('label'),
67 'width': image.get('width'),
68 'height': image.get('height')
69 } for image in data_json.get('images') or [] if image.get('url')]
70 series_json = next(dct for dct in data_json.get('show_tags') or [] if dct.get('video_id') == id) or {}
73 '_type': 'url_transparent',
75 'title': data_json.get('title'),
76 'description': data_json.get('description'),
77 'duration': data_json.get('duration'),
78 'thumbnails': thumbnails,
79 'season_number': series_json.get('season'),
80 'episode_number': series_json.get('episode_number'),
81 'series': try_get(series_json, lambda x: x['tag']['name']),
82 'url': f'https://cdn.jwplayer.com/v2/media/{v_id}'
86 class PokerGoCollectionIE(PokerGoBaseIE):
87 _VALID_URL = r'https?://(?:www\.)?pokergo\.com/collections/(?P<id>[^&$#/?]+)'
90 'url': 'https://www.pokergo.com/collections/19ffe481-5dae-481a-8869-75cc0e3c4700',
91 'playlist_mincount': 13,
93 'id': '19ffe481-5dae-481a-8869-75cc0e3c4700',
97 def _entries(self, id):
98 data_json = self._download_json(f'https://api.pokergo.com/v2/properties/{self._PROPERTY_ID}/collections/{id}?include=entities',
99 id, headers={'authorization': f'Bearer {self._AUTH_TOKEN}'})['data']
100 for video in data_json.get('collection_video') or []:
101 video_id = video.get('id')
103 yield self.url_result(
104 f'https://www.pokergo.com/videos/{video_id}',
105 ie=PokerGoIE.ie_key(), video_id=video_id)
107 def _real_extract(self, url):
108 id = self._match_id(url)
109 return self.playlist_result(self._entries(id), playlist_id=id)