From ba7396afd1e3e7b0a77c39a7bc48065a5e3542f3 Mon Sep 17 00:00:00 2001 From: schnusch Date: Fri, 30 Apr 2021 18:07:44 +0200 Subject: [PATCH] [ninjastream] add thumbnail --- youtube_dl/extractor/ninjastream.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/youtube_dl/extractor/ninjastream.py b/youtube_dl/extractor/ninjastream.py index df7ad30de..9a8b4378a 100644 --- a/youtube_dl/extractor/ninjastream.py +++ b/youtube_dl/extractor/ninjastream.py @@ -5,6 +5,7 @@ import json import posixpath from .common import InfoExtractor +from ..utils import urljoin class NinjaStreamIE(InfoExtractor): @@ -40,6 +41,10 @@ class NinjaStreamIE(InfoExtractor): except KeyError: filename = 'ninjastream.to' + thumbnail = file_meta.get('poster_id') + if thumbnail: + thumbnail = urljoin('https://cdn.ninjastream.to/', thumbnail) + data = {'id': video_id} headers = { 'X-Requested-With': 'XMLHttpRequest', @@ -51,12 +56,14 @@ class NinjaStreamIE(InfoExtractor): video_id, data=data, headers=headers) # Get and parse the m3u8 information + stream_url = stream_meta['result']['playlist'] formats = self._extract_m3u8_formats( - url, video_id, 'mp4', entry_protocol='m3u8_native', + stream_url, video_id, 'mp4', entry_protocol='m3u8_native', m3u8_id='hls') return { 'formats': formats, 'id': video_id, + 'thumbnail': thumbnail, 'title': filename, }