1
0
Fork 0
mirror of https://github.com/ytdl-org/youtube-dl.git synced 2024-11-18 00:05:46 +00:00

[caffeine.tv] Add new extractor

Add CaffeineIE info extractor to support site caffeine.tv
This commit is contained in:
Aaron Tan 2023-08-17 13:49:07 +10:00
parent 86e3cf5e58
commit d5f95494ed
2 changed files with 44 additions and 0 deletions

View file

@ -0,0 +1,43 @@
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
int_or_none,
)
import re
class CaffeineIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?caffeine\.tv/.+/video/(?P<video_id>[0-9a-f-]+)'
_TEST = {
'url': 'https://www.caffeine.tv/TsuSurf/video/cffc0a00-e73f-11ec-8080-80017d29f26e',
'info_dict': {
'id': 'cffc0a00-e73f-11ec-8080-80017d29f26e',
'ext': 'mp4',
'title': 'GOOOOD MORNINNNNN #highlights',
'uploader': 'TsuSurf',
'duration': 3145,
}
}
def _real_extract(self, url):
video_id = re.match(self._VALID_URL, url).group('video_id')
json_data = self._download_json('https://api.caffeine.tv/social/public/activity/' + video_id, video_id)
broadcast_info = json_data['broadcast_info']
title = broadcast_info['broadcast_title']
video_url = broadcast_info['video_url']
formats = self._extract_m3u8_formats(
video_url, video_id, 'mp4')
self._sort_formats(formats)
return {
'id': video_id,
'title': title,
'uploader': json_data['username'],
'duration': int_or_none(broadcast_info['content_duration']),
'like_count': int_or_none(json_data['like_count']),
'formats': formats,
}

View file

@ -159,6 +159,7 @@ from .businessinsider import BusinessInsiderIE
from .buzzfeed import BuzzFeedIE from .buzzfeed import BuzzFeedIE
from .byutv import BYUtvIE from .byutv import BYUtvIE
from .c56 import C56IE from .c56 import C56IE
from .caffeine import CaffeineIE
from .callin import CallinIE from .callin import CallinIE
from .camdemy import ( from .camdemy import (
CamdemyIE, CamdemyIE,