Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[recurbate.com] Add recurbate extractor #6297

Merged
merged 8 commits into from May 31, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions yt_dlp/extractor/_extractors.py
Expand Up @@ -1539,6 +1539,7 @@
RCTIPlusTVIE,
)
from .rds import RDSIE
from .recurbate import RecurbateIE
from .redbee import ParliamentLiveUKIE, RTBFIE
from .redbulltv import (
RedBullTVIE,
Expand Down
42 changes: 42 additions & 0 deletions yt_dlp/extractor/recurbate.py
@@ -0,0 +1,42 @@
import urllib.error

from .common import InfoExtractor
from ..utils import ExtractorError, merge_dicts


class RecurbateIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?recurbate\.com/play\.php\?video=(?P<id>[0-9]+)'
pukkandan marked this conversation as resolved.
Show resolved Hide resolved
_TESTS = [{
'url': 'https://recurbate.com/play.php?video=39161415',
'md5': 'dd2b4ec57aa3e3572cb5cf0997fca99f',
'info_dict': {
'id': '39161415',
'ext': 'mp4',
'description': 'md5:db48d09e4d93fc715f47fd3d6b7edd51',
'title': 'Performer zsnicole33 show on 2022-10-25 20:23, Chaturbate Archive – Recurbate',
'age_limit': 18,
},
'skip': 'Website require membership.',
}]

def _real_extract(self, url):
video_id = self._match_id(url)
try:
webpage = self._download_webpage(url, video_id)
except ExtractorError as e:
if isinstance(e.cause, urllib.error.HTTPError) and e.cause.code == 403:
self.raise_login_required(msg='This video is only available for registered users; Set your authenticated browser user agent via the --user-agent parameter.', method='cookies')
pukkandan marked this conversation as resolved.
Show resolved Hide resolved
raise
title = self._html_extract_title(webpage, 'title')
pukkandan marked this conversation as resolved.
Show resolved Hide resolved
token = self._html_search_regex(r'data-token="([^"]+)"', webpage, 'token')

video_url = f'https://recurbate.com/api/get.php?video={video_id}&token={token}'
video_webpage = self._download_webpage(video_url, video_id)

entries = self._parse_html5_media_entries(video_url, video_webpage, video_id)
return merge_dicts({
'id': video_id,
'title': title,
pukkandan marked this conversation as resolved.
Show resolved Hide resolved
'description': self._og_search_description(webpage),
'age_limit': self._rta_search(webpage),
}, entries[0])