From 42a3b8f9f7ca68eba3bd15b0d191eacfb1ecde02 Mon Sep 17 00:00:00 2001 From: Alhaziel Date: Mon, 2 Dec 2019 17:59:41 +0100 Subject: [PATCH] Fix Piratestreaming --- channels/piratestreaming.json | 56 ++--------------------------------- channels/piratestreaming.py | 38 ++++++++++++++++++++---- 2 files changed, 36 insertions(+), 58 deletions(-) diff --git a/channels/piratestreaming.json b/channels/piratestreaming.json index 5b1ca008..0ad00303 100644 --- a/channels/piratestreaming.json +++ b/channels/piratestreaming.json @@ -4,58 +4,8 @@ "active": true, "adult": false, "language": ["ita"], - "thumbnail": "https:\/\/raw.githubusercontent.com\/Zanzibar82\/images\/master\/posters\/piratestreaming.png", - "bannermenu": "https:\/\/raw.githubusercontent.com\/Zanzibar82\/images\/master\/posters\/piratestreaming.png", + "thumbnail": "piratestreaming.png", + "bannermenu": "piratestreaming.png", "categories": ["anime","movie","tvshow"], - "settings": [ - { - "id": "include_in_global_search", - "type": "bool", - "label": "Includi ricerca globale", - "default": true, - "enabled": true, - "visible": true - }, - { - "id": "include_in_newest_peliculas", - "type": "bool", - "label": "Includi in Novità - Film", - "default": true, - "enabled": true, - "visible": true - }, - { - "id": "include_in_newest_series", - "type": "bool", - "label": "Includi in Novità - Serie TV", - "default": true, - "enabled": true, - "visible": true - }, - { - "id": "include_in_newest_anime", - "type": "bool", - "label": "Includi in Novità - Anime", - "default": true, - "enabled": true, - "visible": true - }, - { - "id": "include_in_newest_italiano", - "type": "bool", - "label": "Includi in Novità - Italiano", - "default": true, - "enabled": true, - "visible": true - }, - { - "id": "filter_languages", - "type": "list", - "label": "Mostrar enlaces en idioma...", - "default": 0, - "enabled": true, - "visible": true, - "lvalues": ["No filtrar","IT"] - } - ] + "settings": [] } diff --git a/channels/piratestreaming.py b/channels/piratestreaming.py index f5fce638..0c72b846 100644 --- a/channels/piratestreaming.py +++ b/channels/piratestreaming.py @@ -43,6 +43,33 @@ def search(item, texto): return [] +def newest(categoria): + support.log(categoria) + itemlist = [] + item = support.Item() + try: + if categoria == "peliculas": + item.url = host + '/category/films' + item.contentType = 'movies' + return peliculas(item) + if categoria == "series": + item.url = host + '/category/serie' + item.contentType = 'tvshow' + return peliculas(item) + if categoria == "anime": + item.url = host + '/category/anime-cartoni-animati' + item.contentType = 'tvshow' + return peliculas(item) + # Continua la ricerca in caso di errore + except: + import sys + for line in sys.exc_info(): + support.logger.error("{0}".format(line)) + return [] + + return itemlist + + @support.scrape def peliculas(item): patron = r'data-placement="bottom" title="(?P[^"]+)" alt=[^=]+="(?P<url>[^"]+)"> <img class="[^"]+" title="[^"]+" alt="[^"]+" src="(?P<thumb>[^"]+)"' @@ -58,12 +85,13 @@ def peliculas(item): @support.scrape def episodios(item): - if item.data: - data = item.data - title = item.title - patron = r'link-episode">\s*(?P<title>\d+.\d+)[^>]+<\/span>\s*(?P<url>.*?)</div>' + if item.data: data = item.data + # debug= True + title = item.fulltitle + patron = r'link-episode">(?:\s*<strong>)?\s*(?P<episode>\d+.\d+(?:.\d+)?)(?:[^\(]+\((?P<lang>[?P<lang>A-Za-z-]+)[^>]+>)?(?:\s*(?P<title>.*?) )[^>]+<\/span>\s*(?P<url>.*?)</div>' def itemHook(item): - item.title += support.typo(' - ', 'bold') + title + if 'Episodio' in item.title: + item.title = support.re.sub(r'Episodio [0-9.-]+', title, item.title) return item return locals()