fix streamingcommunity (antiban)

This commit is contained in:
mac12m99
2021-01-24 19:33:24 +01:00
parent a88acd0c07
commit c443340754
+14 -13
View File
@@ -19,7 +19,7 @@ def getHeaders():
global headers global headers
if not headers: if not headers:
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'} 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) response = session.get(host, headers=headers)
csrf_token = support.match(response.text, patron='name="csrf-token" content="([^"]+)"').match csrf_token = support.match(response.text, patron='name="csrf-token" content="([^"]+)"').match
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', 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', 'content-type': 'application/json;charset=UTF-8',
@@ -100,12 +100,14 @@ def peliculas(item):
getHeaders() getHeaders()
logger.debug() logger.debug()
itemlist = [] itemlist = []
recordlist = []
videoType = 'movie' if item.contentType == 'movie' else 'tv' videoType = 'movie' if item.contentType == 'movie' else 'tv'
page = item.page if item.page else 0 page = item.page if item.page else 0
offset = page * 60 offset = page * 60
if item.records:
if type(item.args) == int: records = item.records
elif type(item.args) == int:
data = support.scrapertools.decodeHtmlentities(support.match(item).data) data = support.scrapertools.decodeHtmlentities(support.match(item).data)
records = json.loads(support.match(data, patron=r'slider-title titles-json="(.*?)" slider-name="').matches[item.args]) records = json.loads(support.match(data, patron=r'slider-title titles-json="(.*?)" slider-name="').matches[item.args])
elif not item.search: elif not item.search:
@@ -122,15 +124,17 @@ def peliculas(item):
else: else:
js = records js = records
with futures.ThreadPoolExecutor() as executor: for i, it in enumerate(js):
itlist = [executor.submit(makeItem, i, it, item) for i, it in enumerate(js)] if i < 20:
for res in futures.as_completed(itlist): itemlist.append(makeItem(i, it, item))
itemlist.append(res.result()) else:
recordlist.append(it)
itemlist.sort(key=lambda item: item.n) itemlist.sort(key=lambda item: item.n)
if recordlist:
if len(itemlist) >= 60: itemlist.append(item.clone(title=support.typo(support.config.get_localized_string(30992), 'color kod bold'), thumbnail=support.thumb(), page=page, records=recordlist))
itemlist.append(item.clone(title=support.typo(support.config.get_localized_string(30992), 'color kod bold'), thumbnail=support.thumb(), page=page + 1)) elif len(itemlist) >= 20:
itemlist.append(item.clone(title=support.typo(support.config.get_localized_string(30992), 'color kod bold'), thumbnail=support.thumb(), records=[], page=page + 1))
support.tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True) support.tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True)
return itemlist return itemlist
@@ -191,9 +195,6 @@ def episodios(item):
def findvideos(item): def findvideos(item):
video_urls = [] video_urls = []
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': 'https://streamingcommunity.net'}
data = support.match(item, headers=headers).data.replace('&quot;','"').replace('\\','') data = support.match(item, headers=headers).data.replace('&quot;','"').replace('\\','')
url = support.match(data, patron=r'video_url"\s*:\s*"([^"]+)"').match url = support.match(data, patron=r'video_url"\s*:\s*"([^"]+)"').match
def videourls(res): def videourls(res):