def WysiwetlanieLinkow(): url = params['url'].replace('//epek', '/epek') url = url.split('/epek/') headers = { 'User-Agent': "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.53 Safari/537.36" } filtered = json.loads( requests.get("https://shinden.herokuapp.com/epek/" + url[1], headers=headers).content) # filtered = json.loads(requests.get("http://127.0.0.1:5000/epek/" + url[1]).content) for i in filtered: try: if 'Polski' in i['audio']: addon.addLink( "%s [COLOR ivory]([B]%s[/B])[/COLOR] - Polskie Audio" % (i['host'], i['quality']), i['link'], mode=6, fanart=_default_background) else: addon.addLink("%s [COLOR ivory]([B]%s[/B])[/COLOR] - %s" % (i['host'], i['quality'], i['napisy']), i['link'], mode=6, fanart=_default_background) except: continue
def WysiwetlanieLinkow(): url = params['url'] name = params['name'] with requests.session() as sess: r = sess.get(url).text result = client.parseDOM( r, 'table', attrs={ 'class': 'table table-bordered table-striped table-hover episode' }) result = client.parseDOM(result, 'tbody') for tr in client.parseDOM(result, 'tr'): r = re.search( r'(?is)[^<]*(?:<tr[^]>*>[^<]*)?<td[^>]*>(?P<name>[^<]*)<.*?' r'<span class="(?:sprites +)?(?P<lang>[^"]*?)(?: +lang)?">.*?' r'\bdata-\w+="(?P<data>[^"]*)"', tr) if r: name, lang, data = r.group('name', 'lang', 'data') try: host, link = get_epsiode_link(sess, data) except InvalidLink as e: pass else: name = "[B][COLOR green]{host}:[/COLOR] {name}[/B] ({lang})".format( **locals()) addon.addLink(name, link, mode=6)
def ListujFilmy(url=""): try: url = urllib.unquote_plus(params['url']) except: pass result = client.request(url) h = HTMLParser() result = h.unescape(result) try: nawigacja = client.parseDOM(result, 'div', attrs={'class': 'wp-pagenavi'}) nastepna = client.parseDOM(nawigacja, 'a', ret='href')[-1] nawigacja = client.parseDOM(nawigacja, 'a', attrs={'class': 'nextpostslink'}) except: nawigacja = "" result = client.parseDOM(result, 'div', attrs={'id': 'left'}) result = client.parseDOM(result, 'div', attrs={'id': 'news'}) for item in result: link = client.parseDOM(item, 'a', ret='href')[0] nazwa = client.parseDOM(item, 'a')[0] addon.addLink(str(nazwa).replace("„", "").replace('”', ''), str(link), mode=6) if len(nawigacja) > 0: addon.addDir("Nastepna strona", str(nastepna), mode=10)
def ListowanieLinkow(): try: url = params['url'] result = client.request(url) nazwy = client.parseDOM(result, 'a', attrs={'class': 'link-iframe'}) result = client.parseDOM(result, 'div', attrs={'dir': 'ltr'})[2] linki = client.parseDOM(result, 'a', ret='href')[1:len(nazwy) + 1] for item in zip(linki, nazwy): link = str(item[0]) title = str(item[1]) addon.addLink(title, link, mode='OdpalanieLinku', fanart=_default_background) except: log_exception()
def Listowanie_Odcinkow(): url = params['url'] s = requests.Session() s.get("http://kabaret.tworzymyhistorie.pl/kabarety/") headers = { 'Host': 'kabaret.tworzymyhistorie.pl', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:60.0) Gecko/20100101 Firefox/60.0', 'Accept': '*/*', 'Accept-Language': 'pl,en-US;q=0.7,en;q=0.3', 'Referer': 'http://kabaret.tworzymyhistorie.pl/kabarety/', 'X-Requested-With': 'XMLHttpRequest', 'Connection': 'keep-alive', } parametry = ( ('tod', 'skecze_lista'), ('cat', url), ('typ', '0'), ('title', ''), ('sort', 'id'), ('order', 'desc'), ('limit', '0'), ('count', '2000'), ) test = s.get('http://kabaret.tworzymyhistorie.pl/index/exec/load.php', headers=headers, params=parametry, cookies=s.cookies) r = test.content linki = client.parseDOM(r, 'a', ret='href') nazwy = client.parseDOM(r, 'img', ret='alt') from collections import OrderedDict linki = OrderedDict((x, True) for x in linki).keys() for item in zip(linki, nazwy): link = "http://kabaret.tworzymyhistorie.pl/" + item[0] nazwa = item[1] if "tvp" in str(nazwa).lower(): continue addon.addLink(str(nazwa), str(link), mode=5)
def ListujLinki(): import resolveurl url = urllib.unquote_plus(params['url']) result = client.request(url) h = HTMLParser() result = h.unescape(result) result = client.parseDOM(result, 'table', attrs={'class': 'table table-bordered'}) linki = client.parseDOM(result, 'a', ret='href') for item in linki: temp = client.request(str(item)) link = client.parseDOM(temp, 'iframe', ret='src')[0] hostDict = resolveurl.relevant_resolvers(order_matters=True) hostDict = [i.domains for i in hostDict if not '*' in i.domains] hostDict = [i.lower() for i in reduce(lambda x, y: x + y, hostDict)] hostDict = [x for y, x in enumerate(hostDict) if x not in hostDict[:y]] valid, host = source_utils.is_host_valid(str(link), hostDict) if valid == False: continue addon.addLink("[B]" + host + "[/B]", link, mode=6)
def ListujFilmy(url=""): try: url = params['url'] except: pass result = client.request(url) h = HTMLParser() result = h.unescape(result) try: nawigacja = client.parseDOM(result, 'div', attrs={'class': 'wp-pagenavi'}) nastepna = client.parseDOM(nawigacja, 'a', ret='href')[-2] nawigacja = client.parseDOM(nawigacja, 'a', attrs={'class': 'nextpostslink'}) except: nawigacja = "" result = client.parseDOM(result, 'div', attrs={'class': 'entry-content'}) for item in result: item2 = client.parseDOM(item, 'div', attrs={'class': 'picture-content '}) if len(item2) == 0: continue opis = client.parseDOM(item, 'div', attrs={'class': 'excerpt sub-lineheight'})[0] link = client.parseDOM(item2, 'a', ret='href')[0] nazwa = client.parseDOM(item2, 'a', ret='title')[0] obraz = client.parseDOM(item2, 'img', ret='src')[0] addon.addLink(str(nazwa), str(link), mode=6, thumb=str(obraz), icon=str(obraz), plot=str(opis)) if len(nawigacja) > 0: addon.addDir("Nastepna strona", str(nastepna), mode=10)
def ListowanieOdcinkow(): try: xbmcplugin.addSortMethod(handle=int(sys.argv[1]), sortMethod=xbmcplugin.SORT_METHOD_TITLE) url = params['url'] r = client.request(url) result = client.parseDOM(r, 'div', attrs={'class': 'item-thumbnail'}) for item in result: h = HTMLParser() item = h.unescape(item) link = str(client.parseDOM(item, 'a', ret='href')[0]) title = str(client.parseDOM(item, 'a', ret='title')[0]) thumb = str(client.parseDOM(item, 'img', ret='src')[0]) addon.addLink(title, link, mode=12, thumb=thumb, icon=thumb, genre='Bajka') except Exception as e: log_exception() return
request = urllib2.Request("https://strefadb.pl" + link, headers=HEADERS) try: response = urllib2.urlopen(request, timeout=int(5)) if request.redirect_dict > 0: keys = request.redirect_dict.keys() except urllib2.HTTPError as response: if request.redirect_dict > 0: keys = request.redirect_dict.keys() pass reallink = '' if type(keys) == list: for key in keys: if not 'strefadb' in key: reallink = key else: reallink = keys o = urlparse(reallink) provider = str(o.netloc) addon.addLink(provider + " Lektor:" + lektor + " Napisy:" + napisy + " Jakość:" + quality, reallink, mode='OdpalanieLinku') elif mode == 'OdpalanieLinku': OdpalanieLinku() ################################################################################### xbmcplugin.endOfDirectory(int(sys.argv[1]))