From 33a21786bfb87907cfd2aa1c2f1faafa8d0e02a5 Mon Sep 17 00:00:00 2001 From: Alhaziel01 Date: Wed, 5 Oct 2022 18:24:35 +0200 Subject: [PATCH] Aggiornamento StreamingCommunity --- channels/streamingcommunity.py | 1 + core/support.py | 11 +++++++++++ servers/streamingcommunityws.py | 16 ++++++++++++---- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/channels/streamingcommunity.py b/channels/streamingcommunity.py index 4c57db36..8e5a59de 100644 --- a/channels/streamingcommunity.py +++ b/channels/streamingcommunity.py @@ -236,6 +236,7 @@ def episodios(item): def findvideos(item): + support.callAds('https://thaudray.com/5/3523301', host) # Fix for old items in videolibrary if item.episodeid and not item.episodeid in item.url: item.url += item.episodeid diff --git a/core/support.py b/core/support.py index e4766614..5ea884dc 100755 --- a/core/support.py +++ b/core/support.py @@ -1659,3 +1659,14 @@ def stackCheck(values): return True frame = frame.f_back return False + + +def callAds(url, host): + try: + import requests + headers = {{'User-Agent': httptools.random_useragent(), + 'Origin': host, + 'Referer': host}} + requests.get(url, headers=headers) + except: + pass \ No newline at end of file diff --git a/servers/streamingcommunityws.py b/servers/streamingcommunityws.py index 40258f7a..882a2bcc 100755 --- a/servers/streamingcommunityws.py +++ b/servers/streamingcommunityws.py @@ -44,13 +44,21 @@ def compose(url): subs = [] video_urls = [] info = support.match(url, patron=r'LANGUAGE="([^"]+)",\s*URI="([^"]+)|RESOLUTION=\d+x(\d+).*?(http[^"\s]+)', headers={'User-Agent':UA}).matches - if info: + if info and not logger.testMode: # ai test non piace questa parte for lang, sub, res, url in info: - if sub and not logger.testMode: # ai test non piace questa parte + if sub: + while True: + match = support.match(sub, patron=r'(http[^\s\n]+)').match + if match: + sub = httptools.downloadpage(match).data + else: + break if lang == 'auto': lang = 'ita-forced' s = config.get_temp_file(lang +'.srt') subs.append(s) - filetools.write(s, support.vttToSrt(httptools.downloadpage(support.match(sub, patron=r'(http[^\s\n]+)').match).data)) + filetools.write(s, support.vttToSrt(sub)) elif url: video_urls.append(['m3u8 [{}]'.format(res), '{}|User-Agent={}'.format(url, UA), 0, subs]) - return video_urls \ No newline at end of file + else: + video_urls.append(['m3u8', '{}|User-Agent={}'.format(url, UA)]) + return video_urls