From 61ee2dc1c6833f8d542875fe824fb17888a0fb06 Mon Sep 17 00:00:00 2001 From: Alhaziel01 Date: Mon, 28 Dec 2020 15:45:23 +0100 Subject: [PATCH] Fix Streaming Community e Ricerca Globale --- channels/streamingcommunity.py | 19 ++++++++++--------- specials/globalsearch.py | 8 ++++---- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/channels/streamingcommunity.py b/channels/streamingcommunity.py index 1888efbe..02f5fd1f 100644 --- a/channels/streamingcommunity.py +++ b/channels/streamingcommunity.py @@ -3,23 +3,24 @@ # Canale per StreamingCommunity # ------------------------------------------------------------ -import requests, json +import json, requests from core import support host = support.config.get_channel_url() - +session = requests.Session() headers = {} def getHeaders(): global headers if not headers: - session = requests.Session() + headers = {'User-Agent': 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14'} response = session.get(host) csrf_token = support.match(response.text, patron='name="csrf-token" content="([^"]+)"').match - headers = {'content-type': 'application/json;charset=UTF-8', - 'Referer': host, - 'x-csrf-token': csrf_token, - 'Cookie': '; '.join([x.name + '=' + x.value for x in response.cookies])} + headers = {'User-Agent': 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14', + 'content-type': 'application/json;charset=UTF-8', + 'Referer': host, + 'x-csrf-token': csrf_token, + 'Cookie': '; '.join([x.name + '=' + x.value for x in response.cookies])} @support.menu @@ -104,10 +105,10 @@ def peliculas(item): records = json.loads(support.match(data, patron=r'slider-title titles-json="(.*?)" slider-name="').matches[item.args]) elif not item.search: payload = json.dumps({'type': videoType, 'offset':offset, 'genre':item.args}) - records = requests.post(host + '/api/browse', headers=headers, data=payload).json()['records'] + records = session.post(host + '/api/browse', headers=headers, data=payload).json()['records'] else: payload = json.dumps({'q': item.search}) - records = requests.post(host + '/api/search', headers=headers, data=payload).json()['records'] + records = session.post(host + '/api/search', headers=headers, data=payload).json()['records'] if records and type(records[0]) == list: js = [] diff --git a/specials/globalsearch.py b/specials/globalsearch.py index cdfd66d6..be8cd372 100644 --- a/specials/globalsearch.py +++ b/specials/globalsearch.py @@ -666,10 +666,10 @@ class SearchWindow(xbmcgui.WindowXMLDialog): self.playmonitor() else: - episodes = self.itemsResult if self.itemsResult else [] + self.episodes = self.itemsResult if self.itemsResult else [] self.itemsResult = [] ep = [] - for item in episodes: + for item in self.episodes: # if item.action == 'findvideos': it = xbmcgui.ListItem(item.title) it.setProperty('item', item.tourl()) @@ -745,8 +745,8 @@ class SearchWindow(xbmcgui.WindowXMLDialog): platformtools.prevent_busy(server) server.window = True server.globalsearch = True - Thread(target=run, args=[server]).start() - # run(server) + if server in ['torrent']: Thread(target=run, args=[server]).start() + else: run(server) try: while not platformtools.is_playing() or not xbmc.Player().getTime() > 0: xbmc.sleep(500)