KoD 0.5.1

-override DNS di default
-nuovi canali: streamtime e netfreex
-fixato cloudflare
-aggiunta opzione apri nel browser
This commit is contained in:
marco
2019-11-30 20:27:09 +01:00
parent 4332859f47
commit daad0d3ddb
176 changed files with 31086 additions and 13812 deletions
+1 -1
View File
@@ -364,7 +364,7 @@ def set_channel_setting(name, value, channel):
file_settings = os.path.join(config.get_data_path(), "settings_channels", channel + "_data.json")
dict_settings = {}
def_settings = get_default_settings(channel)
if channel not in ['trakt']: def_settings = get_default_settings(channel)
dict_file = None
+2 -5
View File
@@ -367,9 +367,6 @@ def proxy_post_processing(url, proxy_data, response, opt):
def downloadpage(url, **opt):
logger.info()
"""
Open a url and return the data obtained
@@ -441,7 +438,7 @@ def downloadpage(url, **opt):
opt['proxy_retries_counter'] += 1
session = cloudscraper.create_scraper()
session.verify = False
# session.verify = False
if opt.get('cookies', True):
session.cookies = cj
session.headers.update(req_headers)
@@ -620,4 +617,4 @@ def fill_fields_post(info_dict, req, response, req_headers, inicio):
import traceback
logger.error(traceback.format_exc(1))
return info_dict, response
return info_dict, response
+70 -59
View File
@@ -107,35 +107,36 @@ def search(channel, item, texto):
def dbg():
import web_pdb;
if not web_pdb.WebPdb.active_instance:
import webbrowser
webbrowser.open('http://127.0.0.1:5555')
web_pdb.set_trace()
if config.dev_mode():
import web_pdb;
if not web_pdb.WebPdb.active_instance:
import webbrowser
webbrowser.open('http://127.0.0.1:5555')
web_pdb.set_trace()
def regexDbg(item, patron, headers, data=''):
import json, urllib2, webbrowser
url = 'https://regex101.com'
if config.dev_mode():
import json, urllib2, webbrowser
url = 'https://regex101.com'
if not data:
html = httptools.downloadpage(item.url, headers=headers, ignore_response_code=True).data.replace("'", '"')
html = re.sub('\n|\t', ' ', html)
else:
html = data
headers = {'content-type': 'application/json'}
data = {
'regex': patron,
'flags': 'gm',
'testString': html,
'delimiter': '"""',
'flavor': 'python'
}
r = urllib2.Request(url + '/api/regex', json.dumps(data, encoding='latin1'), headers=headers)
r = urllib2.urlopen(r).read()
permaLink = json.loads(r)['permalinkFragment']
webbrowser.open(url + "/r/" + permaLink)
if not data:
html = httptools.downloadpage(item.url, headers=headers, ignore_response_code=True).data.replace("'", '"')
html = re.sub('\n|\t', ' ', html)
else:
html = data
headers = {'content-type': 'application/json'}
data = {
'regex': patron,
'flags': 'gm',
'testString': html,
'delimiter': '"""',
'flavor': 'python'
}
r = urllib2.Request(url + '/api/regex', json.dumps(data, encoding='latin1'), headers=headers)
r = urllib2.urlopen(r).read()
permaLink = json.loads(r)['permalinkFragment']
webbrowser.open(url + "/r/" + permaLink)
def scrape2(item, patron = '', listGroups = [], headers="", blacklist="", data="", patronBlock="",
@@ -437,7 +438,7 @@ def scrape(func):
if config.get_setting('downloadenabled') and (function == 'episodios' or function == 'findvideos'):
download(itemlist, item, function=function)
if 'patronMenu' in args:
if 'patronMenu' in args and itemlist:
itemlist = thumb(itemlist, genre=True)
if 'fullItemlistHook' in args:
@@ -530,6 +531,15 @@ def dooplay_search_vars(item, blacklist):
return locals()
def dooplay_menu(item, type):
patron = '<a href="(?P<url>[^"#]+)"(?: title="[^"]+")?>(?P<title>[a-zA-Z0-9]+)'
patronBlock = '<nav class="' + item.args + '">(?P<block>.*?)</nav>'
action = 'peliculas'
return locals()
def swzz_get_url(item):
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:59.0) Gecko/20100101 Firefox/59.0'}
@@ -703,42 +713,42 @@ def typo(string, typography=''):
# If there are no attributes, it applies the default ones
attribute = ['[]','()','{}','submenu','color','bold','italic','_','--','[B]','[I]','[COLOR]']
movie_word_list = ['film', 'serie', 'tv', 'anime', 'cinema', 'sala']
search_word_list = ['cerca']
categories_word_list = ['genere', 'categoria', 'categorie', 'ordine', 'lettera', 'anno', 'alfabetico', 'a-z', 'menu']
# movie_word_list = ['film', 'serie', 'tv', 'anime', 'cinema', 'sala']
# search_word_list = ['cerca']
# categories_word_list = ['genere', 'categoria', 'categorie', 'ordine', 'lettera', 'anno', 'alfabetico', 'a-z', 'menu']
if not any(word in string for word in attribute):
if any(word in string.lower() for word in search_word_list):
string = '[COLOR '+ kod_color +']' + string + '[/COLOR]'
elif any(word in string.lower() for word in categories_word_list):
string = ' > ' + string
elif any(word in string.lower() for word in movie_word_list):
string = '[B]' + string + '[/B]'
# if not any(word in string for word in attribute):
# if any(word in string.lower() for word in search_word_list):
# string = '[COLOR '+ kod_color +']' + string + '[/COLOR]'
# elif any(word in string.lower() for word in categories_word_list):
# string = ' > ' + string
# elif any(word in string.lower() for word in movie_word_list):
# string = '[B]' + string + '[/B]'
# Otherwise it uses the typographical attributes of the string
else:
if '[]' in string:
string = '[' + re.sub(r'\s\[\]','',string) + ']'
if '()' in string:
string = '(' + re.sub(r'\s\(\)','',string) + ')'
if '{}' in string:
string = '{' + re.sub(r'\s\{\}','',string) + '}'
if 'submenu' in string:
string = u"\u2022\u2022 ".encode('utf-8') + re.sub(r'\ssubmenu','',string)
if 'color' in string:
color = scrapertoolsV2.find_single_match(string,'color ([a-z]+)')
if color == 'kod' or '': color = kod_color
string = '[COLOR '+ color +']' + re.sub(r'\scolor\s([a-z]+)','',string) + '[/COLOR]'
if 'bold' in string:
string = '[B]' + re.sub(r'\sbold','',string) + '[/B]'
if 'italic' in string:
string = '[I]' + re.sub(r'\sitalic','',string) + '[/I]'
if '_' in string:
string = ' ' + re.sub(r'\s_','',string)
if '--' in string:
string = ' - ' + re.sub(r'\s--','',string)
if 'bullet' in string:
string = '[B]' + u"\u2022".encode('utf-8') + '[/B] ' + re.sub(r'\sbullet','',string)
# else:
if '[]' in string:
string = '[' + re.sub(r'\s\[\]','',string) + ']'
if '()' in string:
string = '(' + re.sub(r'\s\(\)','',string) + ')'
if '{}' in string:
string = '{' + re.sub(r'\s\{\}','',string) + '}'
if 'submenu' in string:
string = u"\u2022\u2022 ".encode('utf-8') + re.sub(r'\ssubmenu','',string)
if 'color' in string:
color = scrapertoolsV2.find_single_match(string,'color ([a-z]+)')
if color == 'kod' or '': color = kod_color
string = '[COLOR '+ color +']' + re.sub(r'\scolor\s([a-z]+)','',string) + '[/COLOR]'
if 'bold' in string:
string = '[B]' + re.sub(r'\sbold','',string) + '[/B]'
if 'italic' in string:
string = '[I]' + re.sub(r'\sitalic','',string) + '[/I]'
if '_' in string:
string = ' ' + re.sub(r'\s_','',string)
if '--' in string:
string = ' - ' + re.sub(r'\s--','',string)
if 'bullet' in string:
string = '[B]' + u"\u2022".encode('utf-8') + '[/B] ' + re.sub(r'\sbullet','',string)
return string
@@ -915,6 +925,7 @@ def server(item, data='', itemlist=[], headers='', AutoPlay=True, CheckLinks=Tru
verifiedItemlist = []
for videoitem in itemlist:
if not videoitem.server:
videoitem.url = unshortenit.unshorten(videoitem.url)[0]
findS = servertools.findvideos(videoitem.url)
if findS:
findS = findS[0]
+12 -17
View File
@@ -3,19 +3,14 @@
# -*- Created for Alfa-addon -*-
# -*- By the Alfa Develop Group -*
import os
import os, xbmc
from core import httptools, jsontools
from core.item import Item
from platformcode import config, logger
from threading import Thread
import xbmc
from core import httptools
from core import jsontools
from core.item import Item
from platformcode import config
from platformcode import logger
client_id = "c40ba210716aee87f6a9ddcafafc56246909e5377b623b72c15909024448e89d"
client_secret = "999164f25832341f0214453bb11c915adb18e9490d6b5e9a707963a5a1bee43e"
client_id = "404dac2771a60701f1b4e2ec0e9515ece058ec47a66cffce1480aaa022e0aee9"
client_secret = " ad7c56c19f8a633441b3011a7b228c74977deb2eb2749fb5b022f2dc0c96473a"
def auth_trakt():
@@ -29,7 +24,7 @@ def auth_trakt():
post = jsontools.dump(post)
# Se solicita url y código de verificación para conceder permiso a la app
url = "http://api-v2launch.trakt.tv/oauth/device/code"
data = httptools.downloadpage(url, post=post, headers=headers, replace_headers=True).data
data = httptools.downloadpage(url, post=post, headers=headers).data
data = jsontools.load(data)
item.verify_url = data["verification_url"]
item.user_code = data["user_code"]
@@ -63,12 +58,12 @@ def token_trakt(item):
post = {'refresh_token': refresh, 'client_id': client_id, 'client_secret': client_secret,
'redirect_uri': 'urn:ietf:wg:oauth:2.0:oob', 'grant_type': 'refresh_token'}
post = jsontools.dump(post)
data = httptools.downloadpage(url, post, headers, replace_headers=True).data
data = httptools.downloadpage(url, post=post, headers=headers).data
data = jsontools.load(data)
elif item.action == "token_trakt":
url = "http://api-v2launch.trakt.tv/oauth/device/token"
post = "code=%s&client_id=%s&client_secret=%s" % (item.device_code, client_id, client_secret)
data = httptools.downloadpage(url, post, headers, replace_headers=True).data
data = httptools.downloadpage(url, post=post, headers=headers).data
data = jsontools.load(data)
else:
import time
@@ -89,7 +84,7 @@ def token_trakt(item):
url = "http://api-v2launch.trakt.tv/oauth/device/token"
post = {'code': item.device_code, 'client_id': client_id, 'client_secret': client_secret}
post = jsontools.dump(post)
data = httptools.downloadpage(url, post, headers, replace_headers=True).data
data = httptools.downloadpage(url, post=post, headers=headers).data
data = jsontools.load(data)
if "access_token" in data:
# Código introducido, salimos del bucle
@@ -169,7 +164,7 @@ def get_trakt_watched(id_type, mediatype, update=False):
if token_auth:
headers.append(['Authorization', "Bearer %s" % token_auth])
url = "https://api.trakt.tv/sync/watched/%s" % mediatype
data = httptools.downloadpage(url, headers=headers, replace_headers=True).data
data = httptools.downloadpage(url, headers=headers).data
watched_dict = jsontools.load(data)
if mediatype == 'shows':
@@ -214,7 +209,7 @@ def trakt_check(itemlist):
if not synced:
get_sync_from_file()
synced = True
mediatype = 'movies'
id_type = 'tmdb'