2 from __future__ import unicode_literals
4 from .common import InfoExtractor
11 class CamTubeIE(InfoExtractor):
12 _VALID_URL = r'https?://(?:(?:www|api)\.)?camtube\.co/recordings?/(?P<id>[^/?#&]+)'
14 'url': 'https://camtube.co/recording/minafay-030618-1136-chaturbate-female',
16 'id': '42ad3956-dd5b-445a-8313-803ea6079fac',
17 'display_id': 'minafay-030618-1136-chaturbate-female',
19 'title': 'minafay-030618-1136-chaturbate-female',
21 'timestamp': 1528018608,
22 'upload_date': '20180603',
25 'skip_download': True,
29 _API_BASE = 'https://api.camtube.co'
31 def _real_extract(self, url):
32 display_id = self._match_id(url)
34 token = self._download_json(
35 '%s/rpc/session/new' % self._API_BASE, display_id,
36 'Downloading session token')['token']
38 self._set_cookie('api.camtube.co', 'session', token)
40 video = self._download_json(
41 '%s/recordings/%s' % (self._API_BASE, display_id), display_id,
42 headers={'Referer': url})
44 video_id = video['uuid']
45 timestamp = unified_timestamp(video.get('createdAt'))
46 duration = int_or_none(video.get('duration'))
47 view_count = int_or_none(video.get('viewCount'))
48 like_count = int_or_none(video.get('likeCount'))
49 creator = video.get('stageName')
52 'url': '%s/recordings/%s/manifest.m3u8'
53 % (self._API_BASE, video_id),
56 'protocol': 'm3u8_native',
61 'display_id': display_id,
63 'timestamp': timestamp,
65 'view_count': view_count,
66 'like_count': like_count,