diff --git a/README.md b/README.md index cb286c8..120e9cc 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,7 @@ Tv Downloader is een tool om video's van verschillende websites te downloaden. |[tvl.be](https://tvl.be)|✅| |[vrtnws.be](https://vrtnws.be)|✅| |[vrtmax.be](https://vrtmax.be)|✅| +|[nwsnwsnws.be](https://nwsnwsnws.be)|✅| ## Installatie diff --git a/gui/get_videos/getvideo.py b/gui/get_videos/getvideo.py index 2f05240..f7e03b3 100644 --- a/gui/get_videos/getvideo.py +++ b/gui/get_videos/getvideo.py @@ -8,6 +8,7 @@ from .rtv import get_video_from_rtv from .ringtv import get_video_from_ringtv from .standaard import get_video_from_standaard +from .nwsnwsnws import get_video_from_nwsnwsnws from .constants import * from .util import print_error @@ -30,6 +31,8 @@ def get_videos(url, settings, guiParent): videos = get_video_from_vrtnws_single(url,guiParent) elif url.startswith("https://www.vrt.be/vrtnws/") and not '/kijk/' in url: videos = get_video_from_vrtnws_multi(url,guiParent) + elif url.startswith("https://www.vrt.be/nwsnwsnws/"): + videos = get_video_from_nwsnwsnws(url,guiParent) elif url.startswith("https://www.hln.be/"): videos = get_video_from_hln(url) elif url.startswith("https://www.bruzz.be/"): diff --git a/gui/get_videos/nwsnwsnws.py b/gui/get_videos/nwsnwsnws.py new file mode 100644 index 0000000..fc20798 --- /dev/null +++ b/gui/get_videos/nwsnwsnws.py @@ -0,0 +1,38 @@ +from .util import get_request, Video, unixTimeToDatetime, print_error +from .vrtmax import get_vrtmax_token +from .constants import * +import json + +def get_streamUrl(mediaReference,guiParent): + vrtmaxToken = get_vrtmax_token() + url = 'https://media-services-public.vrt.be/media-aggregator/v2/media-items/' + mediaReference + '?vrtPlayerToken=' + vrtmaxToken + '&client=vrtnieuws' + a = get_request(url,{}) + mpegUrl = a['targetUrls'][1]['url'] + streamUrl = mpegUrl.split('?')[0] + if not 'nodrm' in streamUrl: + print_error(STR_6,guiParent) + return streamUrl + +def get_video_from_nwsnwsnws(url,guiParent): + videos = [] + + body = get_request(url,{},False) + try: + data = body.split('')[0] + data = json.loads(data) + + thumbnailUrl = data['props']['pageProps']['data']['compositions'][0]['compositions'][0]['action']['image']['url'] + mediaReference = data['props']['pageProps']['data']['compositions'][0]['compositions'][0]['action']['mediaReference'] + streamUrl = get_streamUrl(mediaReference,guiParent) + title = data['props']['pageProps']['data']['compositions'][0]['compositions'][1]['title']['text'] + description = data['props']['pageProps']['data']['compositions'][0]['compositions'][2]['text']['html'] + date = data['props']['pageProps']['data']['compositions'][0]['compositions'][2]['metadata'][0]['timestamp'] + date = unixTimeToDatetime(int(date/1000)) + fileName = mediaReference.split('$')[1] + '.mp4' + + video = Video(streamUrl, url, title, description, thumbnailUrl, fileName, date) + videos.append(video) + except: + pass + + return videos \ No newline at end of file diff --git a/gui/main.py b/gui/main.py index 58a38f9..f7b188e 100644 --- a/gui/main.py +++ b/gui/main.py @@ -18,7 +18,7 @@ def resource_path(relative_path): def create_icon_from_url(url): image_data = requests.get(url).content - pixmap = QPixmap() + pixmap = QPixmap()() pixmap.loadFromData(image_data) icon = QIcon(pixmap)