3 from .common
import InfoExtractor
10 class PokerGoBaseIE(InfoExtractor
):
11 _NETRC_MACHINE
= 'pokergo'
13 _PROPERTY_ID
= '1dfb3940-7d53-4980-b0b0-f28b369a000d'
15 def _perform_login(self
, username
, password
):
19 PokerGoBaseIE
._AUTH
_TOKEN
= self
._download
_json
(
20 f
'https://subscription.pokergo.com/properties/{self._PROPERTY_ID}/sign-in', None,
21 headers
={'authorization': f'Basic {base64.b64encode(f"{username}
:{password}
".encode()).decode()}'},
22 data=b'')['meta']['token']
23 if not self._AUTH_TOKEN:
24 raise ExtractorError('Unable to get Auth Token.', expected=True)
26 def _real_initialize(self):
27 if not self._AUTH_TOKEN:
28 self.raise_login_required(method='password')
31 class PokerGoIE(PokerGoBaseIE):
32 _VALID_URL = r'https?://(?:www\.)?pokergo\.com/videos/(?P<id>[^&$#/?]+)'
35 'url': 'https://www.pokergo.com/videos/2a70ec4e-4a80-414b-97ec-725d9b72a7dc',
39 'title': 'Poker After Dark | Season 12 (2020) | Cry Me a River | Episode 2',
40 'description': 'md5:c7a8c29556cbfb6eb3c0d5d622251b71',
41 'thumbnail': 'https://cdn.jwplayer.com/v2/media/aVLOxDzY/poster.jpg?width=720',
42 'timestamp': 1608085715,
46 'series': 'poker after dark',
47 'upload_date': '20201216',
48 'season': 'Season 12',
49 'episode': 'Episode 2',
50 'display_id': '2a70ec4e-4a80-414b-97ec-725d9b72a7dc',
52 'params': {'skip_download': True},
55 def _real_extract(self, url):
56 video_id = self._match_id(url)
57 data_json = self._download_json(
58 f'https://api.pokergo.com/v2/properties/{self._PROPERTY_ID}/videos/{video_id}', video_id,
59 headers={'authorization': f'Bearer {self._AUTH_TOKEN}'})['data']
60 v_id = data_json['source']
64 'id': image.get('label'),
65 'width': image.get('width'),
66 'height': image.get('height'),
67 } for image in data_json.get('images') or [] if image.get('url')]
68 series_json = next(dct for dct in data_json.get('show_tags') or [] if dct.get('video_id') == video_id) or {}
71 '_type': 'url_transparent',
72 'display_id': video_id,
73 'title': data_json.get('title'),
74 'description': data_json.get('description'),
75 'duration': data_json.get('duration'),
76 'thumbnails': thumbnails,
77 'season_number': series_json.get('season'),
78 'episode_number': series_json.get('episode_number'),
79 'series': try_get(series_json, lambda x: x['tag']['name']),
80 'url': f'https://cdn.jwplayer.com/v2/media/{v_id}',
84 class PokerGoCollectionIE(PokerGoBaseIE):
85 _VALID_URL = r'https?://(?:www\.)?pokergo\.com/collections/(?P<id>[^&$#/?]+)'
88 'url': 'https://www.pokergo.com/collections/19ffe481-5dae-481a-8869-75cc0e3c4700',
89 'playlist_mincount': 13,
91 'id': '19ffe481-5dae-481a-8869-75cc0e3c4700',
95 def _entries(self, playlist_id):
96 data_json = self._download_json(
97 f'https://api.pokergo.com/v2/properties/{self._PROPERTY_ID}/collections/{playlist_id}?include=entities',
98 playlist_id, headers={'authorization': f'Bearer {self._AUTH_TOKEN}'})['data']
99 for video in data_json.get('collection_video') or []:
100 video_id = video.get('id')
102 yield self.url_result(
103 f'https://www.pokergo.com/videos/{video_id}',
104 ie=PokerGoIE.ie_key(), video_id=video_id)
106 def _real_extract(self, url):
107 playlist_id = self._match_id(url)
108 return self.playlist_result(self._entries(playlist_id), playlist_id=playlist_id)