youtube-dl/youtube_dl/extractor/recurbate.py

35 lines
1.3 KiB
Python
Raw Normal View History

2022-10-23 01:53:43 +09:00
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
class RecurbateIE(InfoExtractor):
_VALID_URL = r'https?:\/\/(?:www\.)?recurbate\.com\/play\.php\?video=(?P<id>[0-9]+)'
_TEST = {
2022-10-26 04:14:18 +09:00
'url': 'https://recurbate.com/play.php?video=39161415',
2022-10-23 01:53:43 +09:00
'info_dict': {
2022-10-26 04:14:18 +09:00
'id': '39161415',
2022-10-23 01:53:43 +09:00
'ext': 'mp4',
2022-10-26 04:14:18 +09:00
'title': 'Performer zsnicole33 show on 2022-10-25 20_23, Chaturbate Archive Recurbate'
2022-10-23 01:53:43 +09:00
},
'skip': 'Requires premium subscription cookie session',
}
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
title = self._html_search_regex(r'<title>(.+?)</title>', webpage, 'title')
token = self._html_search_regex(r'data-token=(.+?")', webpage, 'play_button').strip("\"")
get_url = "https://recurbate.com/api/get.php?video={}&token={}".format(video_id, token)
2022-10-23 01:53:43 +09:00
video_webpage = self._download_webpage(get_url, video_id)
real_url = self._html_search_regex(r'<source src=(.+?) type=\"video\/mp4\"', video_webpage, 'mp4video').strip("\"")
return {
'id': video_id,
'title': title,
'description': self._og_search_description(webpage),
'url': real_url,
}