aboutsummaryrefslogtreecommitdiffstats
path: root/hypervideo_dl/extractor/livestreamfails.py
diff options
context:
space:
mode:
authorJesús <heckyel@hyperbola.info>2022-12-02 05:21:10 +0800
committerJesús <heckyel@hyperbola.info>2022-12-02 05:21:10 +0800
commiteaeeef9c1d1bedb76fea953c332ef84d53bffe2c (patch)
treec3cb5582247e47fc67c24cd7ff8ea857fb76821e /hypervideo_dl/extractor/livestreamfails.py
parent1e5a50b71d8f0eae6007bedc329eecb24bb5aba3 (diff)
downloadhypervideo-eaeeef9c1d1bedb76fea953c332ef84d53bffe2c.tar.lz
hypervideo-eaeeef9c1d1bedb76fea953c332ef84d53bffe2c.tar.xz
hypervideo-eaeeef9c1d1bedb76fea953c332ef84d53bffe2c.zip
update from upstream
Diffstat (limited to 'hypervideo_dl/extractor/livestreamfails.py')
-rw-r--r--hypervideo_dl/extractor/livestreamfails.py37
1 files changed, 37 insertions, 0 deletions
diff --git a/hypervideo_dl/extractor/livestreamfails.py b/hypervideo_dl/extractor/livestreamfails.py
new file mode 100644
index 0000000..0df6384
--- /dev/null
+++ b/hypervideo_dl/extractor/livestreamfails.py
@@ -0,0 +1,37 @@
+from .common import InfoExtractor
+from ..utils import format_field, traverse_obj, unified_timestamp
+
+
+class LivestreamfailsIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?livestreamfails\.com/(?:clip|post)/(?P<id>[0-9]+)'
+ _TESTS = [{
+ 'url': 'https://livestreamfails.com/clip/139200',
+ 'md5': '8a03aea1a46e94a05af6410337463102',
+ 'info_dict': {
+ 'id': '139200',
+ 'ext': 'mp4',
+ 'display_id': 'ConcernedLitigiousSalmonPeteZaroll-O8yo9W2L8OZEKhV2',
+ 'title': 'Streamer jumps off a trampoline at full speed',
+ 'creator': 'paradeev1ch',
+ 'thumbnail': r're:^https?://.+',
+ 'timestamp': 1656271785,
+ 'upload_date': '20220626',
+ }
+ }, {
+ 'url': 'https://livestreamfails.com/post/139200',
+ 'only_matching': True,
+ }]
+
+ def _real_extract(self, url):
+ video_id = self._match_id(url)
+ api_response = self._download_json(f'https://api.livestreamfails.com/clip/{video_id}', video_id)
+
+ return {
+ 'id': video_id,
+ 'display_id': api_response.get('sourceId'),
+ 'timestamp': unified_timestamp(api_response.get('createdAt')),
+ 'url': f'https://livestreamfails-video-prod.b-cdn.net/video/{api_response["videoId"]}',
+ 'title': api_response.get('label'),
+ 'creator': traverse_obj(api_response, ('streamer', 'label')),
+ 'thumbnail': format_field(api_response, 'imageId', 'https://livestreamfails-image-prod.b-cdn.net/image/%s')
+ }