diff --git a/README.md b/README.md index e2c8760..9a1da4c 100644 --- a/README.md +++ b/README.md @@ -2,17 +2,17 @@ ### Addons |Icon|Name|Id|Description|Latest version|MD5| |---|---|---|---|---|---| -|![](addons/zip/script.dandy.domain.manager/icon.png?raw=true)|Domain Manager|script.dandy.domain.manager|Domain Manager|[2.0.0](addons/zip/script.dandy.domain.manager/script.dandy.domain.manager-2.0.0.zip?raw=true)|`762fd48864965c1355cca7bf0c69a8d4`| -|![](addons/zip/plugin.video.kinokong.net/icon.png?raw=true)|Kinokong.net|plugin.video.kinokong.net|Kinokong.net|[2.0.9](addons/zip/plugin.video.kinokong.net/plugin.video.kinokong.net-2.0.9.zip?raw=true)|`f862b9b3945c46d7e6b984b88ba27fb2`| +|![](addons/zip/plugin.video.tivix.net/icon.png?raw=true)|Tivix.net|plugin.video.tivix.net|Tivix.net|[3.0.2](addons/zip/plugin.video.tivix.net/plugin.video.tivix.net-3.0.2.zip?raw=true)|`bd9dc61509274446032c7951739553e4`| |![](addons/zip/plugin.audio.music.yandex/icon.png?raw=true)|Яндекс Музыка|plugin.audio.music.yandex|Яндекс Музыка|[0.1.4](addons/zip/plugin.audio.music.yandex/plugin.audio.music.yandex-0.1.4.zip?raw=true)|`c724f61fcdc22c14aeb6035b8f224b31`| +|![](addons/zip/context.dandy.kinopoisk.sc/icon.png?raw=true)|Kinopoisk Search Content|context.dandy.kinopoisk.sc|Kinopoisk Search Content|[3.0.1](addons/zip/context.dandy.kinopoisk.sc/context.dandy.kinopoisk.sc-3.0.1.zip?raw=true)|`2a42144752cbd501d988f7de1afee79f`| +|![](addons/zip/plugin.video.hdrezka.tv/icon.png?raw=true)|Hdrezka.tv|plugin.video.hdrezka.tv|Hdrezka.tv|[3.2.6](addons/zip/plugin.video.hdrezka.tv/plugin.video.hdrezka.tv-3.2.6.zip?raw=true)|`ad5d3b2bcc5c15f825342db12ad8bd33`| +|![](addons/zip/plugin.video.kinoprosmotr.net/icon.png?raw=true)|Kinoprosmotr.net|plugin.video.kinoprosmotr.net|Kinoprosmotr.net|[3.0.0](addons/zip/plugin.video.kinoprosmotr.net/plugin.video.kinoprosmotr.net-3.0.0.zip?raw=true)|`9eb73856fc321ce9e9337914e219212a`| +|![](addons/zip/plugin.video.kinokong.net/icon.png?raw=true)|Kinokong.net|plugin.video.kinokong.net|Kinokong.net|[2.0.9](addons/zip/plugin.video.kinokong.net/plugin.video.kinokong.net-2.0.9.zip?raw=true)|`f862b9b3945c46d7e6b984b88ba27fb2`| +|![](addons/zip/plugin.audio.dandy.amdm.ru/icon.png?raw=true)|AmDm.ru|plugin.audio.dandy.amdm.ru|Аккорды от AmDm.ru|[2.0.2](addons/zip/plugin.audio.dandy.amdm.ru/plugin.audio.dandy.amdm.ru-2.0.2.zip?raw=true)|`1c260b3ee1d4be9983fb2a0dac324c63`| |![](addons/zip/plugin.audio.iplayer.fm/icon.png?raw=true)|iPlayer.fm|plugin.audio.iplayer.fm|iPlayer.fm - Самые популярые песни|[3.0.1](addons/zip/plugin.audio.iplayer.fm/plugin.audio.iplayer.fm-3.0.1.zip?raw=true)|`9753910a7e9079622e9a54dab95ed294`| +|![](addons/zip/script.dandy.domain.manager/icon.png?raw=true)|Domain Manager|script.dandy.domain.manager|Domain Manager|[2.0.0](addons/zip/script.dandy.domain.manager/script.dandy.domain.manager-2.0.0.zip?raw=true)|`762fd48864965c1355cca7bf0c69a8d4`| |![](addons/zip/plugin.video.dandy.seasonvar.ru/icon.png?raw=true)|seasonvar.ru|plugin.video.dandy.seasonvar.ru|Seasovar.ru Kodi Video Addon|[2.0.9](addons/zip/plugin.video.dandy.seasonvar.ru/plugin.video.dandy.seasonvar.ru-2.0.9.zip?raw=true)|`b4137559b24671d1ee4ca9025bae1725`| -|![](addons/zip/script.dandy.strm.marker/icon.png?raw=true)|STRM Marker|script.dandy.strm.marker|STRM Marker|[2.0.0](addons/zip/script.dandy.strm.marker/script.dandy.strm.marker-2.0.0.zip?raw=true)|`7d560c96ff9b08e2dec0add0db0409d2`| |![](addons/zip/context.dandy.mediainfo/icon.png?raw=true)|Media Info|context.dandy.mediainfo|Open Media Info by current Item|[2.0.2](addons/zip/context.dandy.mediainfo/context.dandy.mediainfo-2.0.2.zip?raw=true)|`67ff00d7c54412fc6939344719ed3e1f`| -|![](addons/zip/repository.dandy.kodi/icon.png?raw=true)|Dandy's Kodi Repository (Matrix)|repository.dandy.kodi|Install Add-ons from Dandy add-on repository|[2.1.0](addons/zip/repository.dandy.kodi/repository.dandy.kodi-2.1.0.zip?raw=true)|`14640627d4ee36d5e4df8f7f2e0b8bdd`| -|![](addons/zip/plugin.audio.dandy.amdm.ru/icon.png?raw=true)|AmDm.ru|plugin.audio.dandy.amdm.ru|Аккорды от AmDm.ru|[2.0.2](addons/zip/plugin.audio.dandy.amdm.ru/plugin.audio.dandy.amdm.ru-2.0.2.zip?raw=true)|`1c260b3ee1d4be9983fb2a0dac324c63`| -|![](addons/zip/plugin.video.hdrezka.tv/icon.png?raw=true)|Hdrezka.tv|plugin.video.hdrezka.tv|Hdrezka.tv|[3.2.5](addons/zip/plugin.video.hdrezka.tv/plugin.video.hdrezka.tv-3.2.5.zip?raw=true)|`5fae038ff39c380103bce65e7f66a166`| -|![](addons/zip/plugin.video.tivix.net/icon.png?raw=true)|Tivix.net|plugin.video.tivix.net|Tivix.net|[3.0.2](addons/zip/plugin.video.tivix.net/plugin.video.tivix.net-3.0.2.zip?raw=true)|`bd9dc61509274446032c7951739553e4`| |![](addons/zip/context.dandy.strm.generator/icon.png?raw=true)|STRM Generator|context.dandy.strm.generator|STRM Generator|[2.0.0](addons/zip/context.dandy.strm.generator/context.dandy.strm.generator-2.0.0.zip?raw=true)|`4d358fd4d806ec6c64e4fbbaa3396a32`| -|![](addons/zip/plugin.video.kinoprosmotr.net/icon.png?raw=true)|Kinoprosmotr.net|plugin.video.kinoprosmotr.net|Kinoprosmotr.net|[3.0.0](addons/zip/plugin.video.kinoprosmotr.net/plugin.video.kinoprosmotr.net-3.0.0.zip?raw=true)|`9eb73856fc321ce9e9337914e219212a`| -|![](addons/zip/context.dandy.kinopoisk.sc/icon.png?raw=true)|Kinopoisk Search Content|context.dandy.kinopoisk.sc|Kinopoisk Search Content|[3.0.1](addons/zip/context.dandy.kinopoisk.sc/context.dandy.kinopoisk.sc-3.0.1.zip?raw=true)|`2a42144752cbd501d988f7de1afee79f`| +|![](addons/zip/script.dandy.strm.marker/icon.png?raw=true)|STRM Marker|script.dandy.strm.marker|STRM Marker|[2.0.0](addons/zip/script.dandy.strm.marker/script.dandy.strm.marker-2.0.0.zip?raw=true)|`7d560c96ff9b08e2dec0add0db0409d2`| +|![](addons/zip/repository.dandy.kodi/icon.png?raw=true)|Dandy's Kodi Repository (Matrix)|repository.dandy.kodi|Install Add-ons from Dandy add-on repository|[2.1.0](addons/zip/repository.dandy.kodi/repository.dandy.kodi-2.1.0.zip?raw=true)|`14640627d4ee36d5e4df8f7f2e0b8bdd`| diff --git a/addons/addons.xml b/addons/addons.xml index b4011f1..88d7143 100644 --- a/addons/addons.xml +++ b/addons/addons.xml @@ -1,62 +1,52 @@ - - - - - - - all - Translit for xbmc plugins. - - - - - + - - - executable - - - video - + + all - Domain Manager - Manage domain setting in Kodi add-ons + VideoHosts + VideoHosts GNU GPL v.3 - - icon.png - - + - + - - - - - + - - video - - - Kinokong.net - For personal use only + + all - - icon.png - fanart.jpg - + Translit for xbmc plugins. + + + + + + + + + > + video + + + Tivix.net + Tivix.net + For personal use only + all + + icon.png + fanart.jpg + + @@ -79,19 +69,31 @@ - + - + - - audio + + video - - iPlayer.fm - Самые популярые песни - For personal use only + + executable + + + + + Container.Content(tvshows)|Container.Content(movies)|Container.Content(musicvideos) + + + all + Kinopoisk Search Content + Kinopoisk Search Content + GNU GENERAL PUBLIC LICENSE. Version 3, 29 June 2007 + + icon.png fanart.jpg @@ -99,112 +101,111 @@ - + + + + + + + + + + video + + + Hdrezka.tv + HDREZKA.TV - Фильмы, мультфильмы и сериалы в высоком качестве + For personal use only + all + + icon.png + fanart.jpg + + + + + + + - + video - Seasovar.ru Kodi Video Addon - Site seasonvar.ru contains best series and all seasons. - Дополнение Kodi для Seasonvar.ru - На сайте seasonvar.ru собрание лучших сериалов и ВСЕХ их сезонов. + Kinoprosmotr.net + For personal use only all icon.png fanart.jpg - ru en - + - + + + + + - - + + video + + + Kinokong.net + For personal use only all - XbmcHelpers based on Parsedom module. icon.png + fanart.jpg - - + - + - - executable - + + audio + Аккорды от AmDm.ru + Аккорды от AmDm.ru all - STRM Marker - Mark STRM content in Libraries - - - GNU GPL v.3 icon.png + fanart.jpg - + - + - - + + - - - - Container.Content(tvshows)|Container.Content(movies)|Container.Content(musicvideos)|Pvr.HasTVChannels - + + audio - + + iPlayer.fm - Самые популярые песни + For personal use only all - Open Media Info by current Item - Open Media Info by current Item - GNU GENERAL PUBLIC LICENSE. Version 3, 29 June 2007 - - icon.png + fanart.jpg - - - - https://raw.github.com/dandygithub/kodi/matrix/addons/addons.xml - https://raw.github.com/dandygithub/kodi/matrix/addons/addons.xml.md5 - https://raw.github.com/dandygithub/kodi/matrix/addons/zip/ - - - - Install Add-ons from Dandy add-on repository - Download and install add-ons from dandy - Add-ons for home usage in Kodi - all - - icon.png - fanart.jpg - - - - @@ -236,146 +237,136 @@ - + + - - + + executable + + + video + all - VideoHosts - VideoHosts + Domain Manager + Manage domain setting in Kodi add-ons GNU GPL v.3 + + icon.png + + + + + + + + + + + + video + + + + Favorites for xbmc plugins + all + + icon.png + - + + - - audio + + video + - Аккорды от AmDm.ru - Аккорды от AmDm.ru + Seasovar.ru Kodi Video Addon + Site seasonvar.ru contains best series and all seasons. + Дополнение Kodi для Seasonvar.ru + На сайте seasonvar.ru собрание лучших сериалов и ВСЕХ их сезонов. all icon.png fanart.jpg + ru en - - - - - - - - - - video - - - Hdrezka.tv - HDREZKA.TV - Фильмы, мультфильмы и сериалы в высоком качестве - For personal use only - all - - icon.png - fanart.jpg - - - - - - - - - - > - video - - - Tivix.net - Tivix.net - For personal use only - all - - icon.png - fanart.jpg - - - - - + - - + + - - - True + + Container.Content(tvshows)|Container.Content(movies)|Container.Content(musicvideos)|Pvr.HasTVChannels - all - STRM Generator - STRM Generator + Open Media Info by current Item + Open Media Info by current Item GNU GENERAL PUBLIC LICENSE. Version 3, 29 June 2007 icon.png - fanart.jpg - + - - - - video - - - - Favorites for xbmc plugins + + all + XbmcHelpers based on Parsedom module. icon.png + - + - - - - video + + + + + True + - - Kinoprosmotr.net - For personal use only + + all + STRM Generator + STRM Generator + GNU GENERAL PUBLIC LICENSE. Version 3, 29 June 2007 + + icon.png fanart.jpg @@ -383,35 +374,44 @@ - + - - + - - video - - - executable - - - - - Container.Content(tvshows)|Container.Content(movies)|Container.Content(musicvideos) - + + executable - + all - Kinopoisk Search Content - Kinopoisk Search Content - GNU GENERAL PUBLIC LICENSE. Version 3, 29 June 2007 - - + STRM Marker + Mark STRM content in Libraries + + + GNU GPL v.3 icon.png - fanart.jpg - + + + + + + + https://raw.github.com/dandygithub/kodi/matrix/addons/addons.xml + https://raw.github.com/dandygithub/kodi/matrix/addons/addons.xml.md5 + https://raw.github.com/dandygithub/kodi/matrix/addons/zip/ + + + + Install Add-ons from Dandy add-on repository + Download and install add-ons from dandy + Add-ons for home usage in Kodi + all + + icon.png + fanart.jpg + + diff --git a/addons/addons.xml.md5 b/addons/addons.xml.md5 index d8ffef6..a9d3f4d 100644 --- a/addons/addons.xml.md5 +++ b/addons/addons.xml.md5 @@ -1 +1 @@ -b6f2d93ddbd724ea150dd65f2c13ca2b \ No newline at end of file +ea7ef48634e3252d3194cf4d3d00d796 \ No newline at end of file diff --git a/addons/plugin.video.hdrezka.tv/addon.xml b/addons/plugin.video.hdrezka.tv/addon.xml index 83e6a34..038c0e5 100644 --- a/addons/plugin.video.hdrezka.tv/addon.xml +++ b/addons/plugin.video.hdrezka.tv/addon.xml @@ -1,5 +1,5 @@  - + diff --git a/addons/plugin.video.hdrezka.tv/default.py b/addons/plugin.video.hdrezka.tv/default.py index 4db3088..866911f 100644 --- a/addons/plugin.video.hdrezka.tv/default.py +++ b/addons/plugin.video.hdrezka.tv/default.py @@ -24,6 +24,65 @@ import router from voidboost import parse_streams +from requests.adapters import HTTPAdapter +from urllib3.util.retry import Retry + +import json +import urllib.parse +import time + +import hashlib +import sys + +ADDON_PATH = os.path.dirname(__file__) +LIB_PATH = os.path.join(ADDON_PATH, "resources", "lib") + +if LIB_PATH not in sys.path: + sys.path.insert(0, LIB_PATH) +xbmc.log(str(sys.path), xbmc.LOGINFO) +from bs4 import BeautifulSoup + +if LIB_PATH not in sys.path: + sys.path.insert(0, LIB_PATH) + + +def anubis_pow(random_data, difficulty): + + nonce = 0 + + zero_bytes = difficulty // 2 + half = difficulty % 2 + + while True: + + digest = hashlib.sha256( + (random_data + str(nonce)).encode() + ).digest() + + ok = True + + for i in range(zero_bytes): + if digest[i] != 0: + ok = False + break + + if ok and half: + if digest[zero_bytes] >> 4 != 0: + ok = False + + if ok: + return digest.hex(), nonce + + nonce += 1 + + +retry = Retry( + total=3, + backoff_factor=1, + status_forcelist=[500,502,503,504] +) + + common = XbmcHelpers transliterate = Translit() @@ -33,6 +92,70 @@ class HdrezkaTV: + + def solve_anubis(self, html, url): + + soup = BeautifulSoup(html, "html.parser") + + node = soup.find( + id="anubis_challenge" + ) + + if node is None: + helpers.log("No anubis_challenge found") + return False + + data = json.loads(node.text) + + challenge = data["challenge"] + + start = time.time() + + hash_value, nonce = anubis_pow( + challenge["randomData"], + challenge["difficulty"] + ) + + elapsed = int((time.time()-start)*1000) + + + helpers.log( + f"Anubis solved nonce={nonce}" + ) + + + from urllib.parse import urljoin + + pass_url = urljoin( + self.url, + "/.within.website/x/cmd/anubis/api/pass-challenge" + ) + + pass_url += "?" + urllib.parse.urlencode({ + "id": challenge["id"], + "response": hash_value, + "nonce": nonce, + "elapsedTime": elapsed, + "redir": url + }) + + + r = self.session.get( + pass_url, + allow_redirects=False + ) + + + helpers.log( + f"Anubis pass status {r.status_code}" + ) + + helpers.log( + f"Cookies: {self.session.cookies}" + ) + + return True + def __init__(self): self.id = 'plugin.video.hdrezka.tv' self.addon = xbmcaddon.Addon(self.id) @@ -52,13 +175,28 @@ def __init__(self): self.proxies = self._load_proxy_settings() self.session = self._load_session() + def _save_session(self): + try: + self.addon.setSetting("cookies",helpers.dump_cookies(self.session.cookies)) + except Exception as e: + helpers.log("save cookies failed: %s" % e) + def _load_session(self): session = requests.Session() - session.headers = { - 'Host': self.domain, - 'Referer': self.domain, - 'User-Agent': USER_AGENT, - } + + retry = Retry( + total=3, + backoff_factor=1, + status_forcelist=[500, 502, 503, 504] + ) + + adapter = HTTPAdapter(max_retries=retry) + session.mount("https://", adapter) + session.mount("http://", adapter) + session.headers.update({ + "User-Agent": USER_AGENT, + "Referer": self.url + "/", + }) saved_cookies = self.addon.getSetting('cookies') if saved_cookies: @@ -78,8 +216,29 @@ def _load_proxy_settings(self): 'https': proxy_protocol + '://' + proxy_url } - def make_response(self, method, uri, params=None, data=None, cookies=None, headers=None, **kwargs): - return self.session.request(method, self.url + uri, params=params, data=data, headers=headers, cookies=cookies, **kwargs) + def make_response(self, method, uri, params=None, data=None,cookies=None, headers=None, **kwargs): + + self.headers = { + "User-Agent": + "Mozilla/5.0 (Windows NT 6.2; WOW64; rv:40.0) Gecko/20100101 Firefox/40.0" + } + if cookies: + self.session.cookies.update(cookies) + + response = self.session.request( + method, + self.url + uri, + params=params, + data=data, + headers=headers, + proxies=self.proxies, + timeout=120, + **kwargs + ) + + self._save_session() + + return response def main(self, action): params = router.parse_uri(action) @@ -349,7 +508,35 @@ def select_translator(self, content, tv_show, post_id, url, idt, action): def show(self, uri): response = self.make_response('GET', uri) - content = common.parseDOM(response.text, "div", attrs={"class": "b-content__main"})[0] + if "anubis_challenge" in response.text: + helpers.log("Anubis challenge detected") + + if not self.solve_anubis(response.text, uri): + helpers.log("Anubis solve failed") + return + + response = self.make_response('GET', uri) + helpers.log("received protection page instead of movie page") + helpers.log(response.text) + helpers.log("Solving Anubis") + + if not self.solve_anubis(response.text, uri): + helpers.log("Anubis failed") + return + + response = self.make_response('GET', uri) + + content_list = common.parseDOM( + response.text, + "div", + attrs={"class": "b-content__main"} + ) + + if not content_list: + helpers.log("fault parse main content") + return + + content = content_list[0] image = common.parseDOM(content, "img", attrs={"itemprop": "image"}, ret="src")[0] title = common.parseDOM(content, "h1")[0] post_id = common.parseDOM(response.text, "input", attrs={"id": "post_id"}, ret="value")[0] diff --git a/addons/plugin.video.hdrezka.tv/helpers.py b/addons/plugin.video.hdrezka.tv/helpers.py index 24ed128..bdb2b20 100644 --- a/addons/plugin.video.hdrezka.tv/helpers.py +++ b/addons/plugin.video.hdrezka.tv/helpers.py @@ -5,7 +5,47 @@ import xbmc +from requests.cookies import RequestsCookieJar, create_cookie + +def dump_cookies(cookies): + data = [] + + for cookie in cookies: + data.append({ + "name": cookie.name, + "value": cookie.value, + "domain": cookie.domain, + "path": cookie.path, + "secure": cookie.secure, + "expires": cookie.expires, + }) + + return json.dumps(data) + + +def load_cookies(src): + jar = RequestsCookieJar() + + try: + cookies = json.loads(src) + + for c in cookies: + jar.set_cookie( + create_cookie( + name=c["name"], + value=c["value"], + domain=c.get("domain", ""), + path=c.get("path", "/"), + secure=c.get("secure", False), + expires=c.get("expires") + ) + ) + + except Exception as e: + log(f"load cookies failed: {e}") + + return jar def log(msg, level=xbmc.LOGINFO): xbmc.log(f'hdrezka: {msg}', level) @@ -45,11 +85,7 @@ def built_title(name, country_years, **kwargs): colored_info = f'[COLOR=55FFFFFF]{kwargs["age_limit"]} ({country_years})[/COLOR]' return f'{name} {colored_rating} {colored_info}' -def dump_cookies(cookies): - return json.dumps(dict(cookies)) -def load_cookies(src): - return cookiejar_from_dict(json.loads(src)) def get_subtitles(response): subtitles = None diff --git a/addons/plugin.video.hdrezka.tv/resources/settings.xml b/addons/plugin.video.hdrezka.tv/resources/settings.xml index dd9f870..d2de731 100644 --- a/addons/plugin.video.hdrezka.tv/resources/settings.xml +++ b/addons/plugin.video.hdrezka.tv/resources/settings.xml @@ -5,7 +5,7 @@ - +