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',
26 'skip_download': True,
30 _API_BASE = 'https://api.camtube.co'
32 def _real_extract(self, url):
33 display_id = self._match_id(url)
35 token = self._download_json(
36 '%s/rpc/session/new' % self._API_BASE, display_id,
37 'Downloading session token')['token']
39 self._set_cookie('api.camtube.co', 'session', token)
41 video = self._download_json(
42 '%s/recordings/%s' % (self._API_BASE, display_id), display_id,
43 headers={'Referer': url})
45 video_id = video['uuid']
46 timestamp = unified_timestamp(video.get('createdAt'))
47 duration = int_or_none(video.get('duration'))
48 view_count = int_or_none(video.get('viewCount'))
49 like_count = int_or_none(video.get('likeCount'))
50 creator = video.get('stageName')
53 'url': '%s/recordings/%s/manifest.m3u8'
54 % (self._API_BASE, video_id),
57 'protocol': 'm3u8_native',
62 'display_id': display_id,
64 'timestamp': timestamp,
66 'view_count': view_count,
67 'like_count': like_count,