diff options
author | lorpus <ligma@poggers.me> | 2020-11-14 19:55:50 -0500 |
---|---|---|
committer | lorpus <ligma@poggers.me> | 2020-11-14 19:55:50 -0500 |
commit | 2b547dd782bb31104085eef067d71ea7144b70ba (patch) | |
tree | a978b614d0566adaad5cffb9f814c28772124f74 /youtube_dlc/extractor | |
parent | d052b9a112fb7ae749a829dceba6e3289663a303 (diff) | |
download | hypervideo-pre-2b547dd782bb31104085eef067d71ea7144b70ba.tar.lz hypervideo-pre-2b547dd782bb31104085eef067d71ea7144b70ba.tar.xz hypervideo-pre-2b547dd782bb31104085eef067d71ea7144b70ba.zip |
[bitwave.tv] new extractor
Diffstat (limited to 'youtube_dlc/extractor')
-rw-r--r-- | youtube_dlc/extractor/bitwave.py | 51 | ||||
-rw-r--r-- | youtube_dlc/extractor/extractors.py | 4 |
2 files changed, 55 insertions, 0 deletions
diff --git a/youtube_dlc/extractor/bitwave.py b/youtube_dlc/extractor/bitwave.py new file mode 100644 index 000000000..6fe02c8c2 --- /dev/null +++ b/youtube_dlc/extractor/bitwave.py @@ -0,0 +1,51 @@ +from .common import InfoExtractor + + +class BitwaveReplayIE(InfoExtractor): + IE_NAME = 'bitwave:replay' + _VALID_URL = r'https?://(?:www\.)?bitwave\.tv/(?P<user>\w+)/replay/(?P<id>\w+)/?$' + + def _real_extract(self, url): + replay_id = self._match_id(url) + replay = self._download_json( + 'https://api.bitwave.tv/v1/replays/' + replay_id, + replay_id + ) + + return { + 'id': replay_id, + 'title': replay['data']['title'], + 'uploader': replay['data']['name'], + 'uploader_id': replay['data']['name'], + 'url': replay['data']['url'], + 'thumbnails': [ + {'url': x} for x in replay['data']['thumbnails'] + ], + } + + +class BitwaveStreamIE(InfoExtractor): + IE_NAME = 'bitwave:stream' + _VALID_URL = r'https?://(?:www\.)?bitwave\.tv/(?P<id>\w+)/?$' + + def _real_extract(self, url): + username = self._match_id(url) + channel = self._download_json( + 'https://api.bitwave.tv/v1/channels/' + username, + username) + + formats = self._extract_m3u8_formats( + channel['data']['url'], username, + 'mp4') + self._sort_formats(formats) + + return { + 'id': username, + 'title': self._live_title(channel['data']['title']), + 'uploader': username, + 'uploader_id': username, + 'formats': formats, + 'thumbnail': channel['data']['thumbnail'], + 'is_live': True, + 'view_count': channel['data']['viewCount'] + } diff --git a/youtube_dlc/extractor/extractors.py b/youtube_dlc/extractor/extractors.py index c77ca12cc..90232c2a7 100644 --- a/youtube_dlc/extractor/extractors.py +++ b/youtube_dlc/extractor/extractors.py @@ -116,6 +116,10 @@ from .bitchute import ( BitChuteIE, BitChuteChannelIE, ) +from .bitwave import ( + BitwaveReplayIE, + BitwaveStreamIE, +) from .biqle import BIQLEIE from .bleacherreport import ( BleacherReportIE, |