diff --git a/plugin.video.powerunlimited/addon.py b/plugin.video.powerunlimited/addon.py index 061c8cdd07..47c36f7c47 100644 --- a/plugin.video.powerunlimited/addon.py +++ b/plugin.video.powerunlimited/addon.py @@ -21,7 +21,7 @@ xbmc.log("[ADDON] %s, Python Version %s" % (ADDON, str(sys.version)), xbmc.LOGDEBUG) xbmc.log("[ADDON] %s v%s (%s) is starting, ARGV = %s" % (ADDON, VERSION, DATE, repr(sys.argv)), xbmc.LOGDEBUG) - from resources.lib import powerunlimited_main as plugin + from resources.lib import powerunlimited_list as plugin else: action = urllib.parse.parse_qs(urllib.parse.urlparse(sys.argv[2]).query)['action'][0] # diff --git a/plugin.video.powerunlimited/addon.xml b/plugin.video.powerunlimited/addon.xml index 49e8f290e5..4e7b2e800a 100644 --- a/plugin.video.powerunlimited/addon.xml +++ b/plugin.video.powerunlimited/addon.xml @@ -2,7 +2,7 @@ @@ -18,17 +18,20 @@ all Watch videos from PowerUnlimited Tv (dutch) - Watch videos from PowerUnlimited Tv (dutch) - For bugs, requests or general questions visit the PowerUnlimited Tv thread on the Kodi forum. + Watch videos from PowerUnlimited Tv (dutch) + For bugs, requests or general questions visit the PowerUnlimited Tv thread on the Kodi forum. Bekijk videos van PowerUnlimited Tv (dutch) - Bekijk videos van PowerUnlimited Tv (dutch) - Bugs of andere feedback op deze plugin kan geplaatst worden in de PowerUnlimited Tv thread op het Kodi forum. + Bekijk videos van PowerUnlimited Tv (dutch) + Bugs of andere feedback op deze plugin kan geplaatst worden in de PowerUnlimited Tv thread op het Kodi forum. nl all GPL-2.0-or-later http://forum.xbmc.org/showthread.php?tid=203211 - http://www.pu.nl/ + https://www.pu.nl/ https://github.com/skipmodea1/plugin.video.powerunlimited.python3 + v1.0.8 (2024-10-04) + - updated the addon to use the changed website + resources/icon.png resources/fanart.jpg diff --git a/plugin.video.powerunlimited/changelog.txt b/plugin.video.powerunlimited/changelog.txt index 500d25c8a4..0163564d78 100644 --- a/plugin.video.powerunlimited/changelog.txt +++ b/plugin.video.powerunlimited/changelog.txt @@ -1,3 +1,6 @@ +v1.0.8 (2024-10-04) +- updated the addon to use the changed website + v1.0.7 (2018-01-20) - removed looking for video dialogue - addon now works in kode python 2 and should also work in python 3 (!!) once all dependencies work in python 3. diff --git a/plugin.video.powerunlimited/resources/language/resource.language.en_gb/strings.po b/plugin.video.powerunlimited/resources/language/resource.language.en_gb/strings.po index c3ec80d17a..1ec4cfd547 100644 --- a/plugin.video.powerunlimited/resources/language/resource.language.en_gb/strings.po +++ b/plugin.video.powerunlimited/resources/language/resource.language.en_gb/strings.po @@ -28,11 +28,11 @@ msgid "For bugs, requests or general questions visit the PowerUnlimited Tv threa msgstr "" msgctxt "#30000" -msgid "All Videos" +msgid "Videos" msgstr "" msgctxt "#30001" -msgid "PU-TV" +msgid "Podcasts" msgstr "" msgctxt "#30002" diff --git a/plugin.video.powerunlimited/resources/language/resource.language.nl_nl/strings.po b/plugin.video.powerunlimited/resources/language/resource.language.nl_nl/strings.po index c826ac06c1..a97cef338a 100644 --- a/plugin.video.powerunlimited/resources/language/resource.language.nl_nl/strings.po +++ b/plugin.video.powerunlimited/resources/language/resource.language.nl_nl/strings.po @@ -28,12 +28,12 @@ msgid "For bugs, requests or general questions visit the PowerUnlimited Tv threa msgstr "Bugs of andere feedback op deze plugin kan geplaatst worden in de PowerUnlimited Tv thread op het Kodi forum." msgctxt "#30000" -msgid "All Videos" -msgstr "Alles" +msgid "Videos" +msgstr "Videos" msgctxt "#30001" -msgid "PU-TV" -msgstr "PU-TV" +msgid "Podcasts" +msgstr "Podcasts" msgctxt "#30002" msgid "Trailers" diff --git a/plugin.video.powerunlimited/resources/lib/powerunlimited_const.py b/plugin.video.powerunlimited/resources/lib/powerunlimited_const.py index 793e0525ec..24c832efb0 100644 --- a/plugin.video.powerunlimited/resources/lib/powerunlimited_const.py +++ b/plugin.video.powerunlimited/resources/lib/powerunlimited_const.py @@ -15,8 +15,9 @@ LANGUAGE = SETTINGS.getLocalizedString IMAGES_PATH = os.path.join(xbmcaddon.Addon().getAddonInfo('path'), 'resources') HEADERS = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36'} -DATE = "2018-01-20" -VERSION = "1.0.7" +VIDEO_LIST_PAGE_URL = "https://pu.nl/artikelen/videos/" +DATE = "2024-10-04" +VERSION = "1.0.8" if sys.version_info[0] > 2: diff --git a/plugin.video.powerunlimited/resources/lib/powerunlimited_const.pyo b/plugin.video.powerunlimited/resources/lib/powerunlimited_const.pyo deleted file mode 100644 index 3977cb9583..0000000000 Binary files a/plugin.video.powerunlimited/resources/lib/powerunlimited_const.pyo and /dev/null differ diff --git a/plugin.video.powerunlimited/resources/lib/powerunlimited_list.py b/plugin.video.powerunlimited/resources/lib/powerunlimited_list.py index 07d7ed5f43..f364010c71 100644 --- a/plugin.video.powerunlimited/resources/lib/powerunlimited_list.py +++ b/plugin.video.powerunlimited/resources/lib/powerunlimited_list.py @@ -6,16 +6,16 @@ # from future import standard_library standard_library.install_aliases() -from builtins import str from builtins import object -from resources.lib.powerunlimited_const import ADDON, LANGUAGE, IMAGES_PATH, HEADERS, convertToUnicodeString, log, getSoup import os -import re import sys import urllib.request, urllib.parse, urllib.error import xbmcgui import xbmcplugin import requests +import json + +from resources.lib.powerunlimited_const import ADDON, IMAGES_PATH, HEADERS, VIDEO_LIST_PAGE_URL, convertToUnicodeString, log # @@ -34,33 +34,6 @@ def __init__(self): log("ARGV", repr(sys.argv)) - # Parse parameters... - self.plugin_category = urllib.parse.parse_qs(urllib.parse.urlparse(sys.argv[2]).query)['plugin_category'][0] - self.video_list_page_url = urllib.parse.parse_qs(urllib.parse.urlparse(sys.argv[2]).query)['url'][0] - self.next_page_possible = urllib.parse.parse_qs(urllib.parse.urlparse(sys.argv[2]).query)['next_page_possible'][0] - - log("self.video_list_page_url", self.video_list_page_url) - - if self.next_page_possible == 'True': - # Determine current item number, next item number, next_url - # http://www.pu.nl/media/pu-tv/?page=001/ - pos_of_page = self.video_list_page_url.rfind('?page=') - if pos_of_page >= 0: - page_number_str = str( - self.video_list_page_url[pos_of_page + len('?page='):pos_of_page + len('?page=') + len('000')]) - page_number = int(page_number_str) - self.current_page = page_number - page_number_next = page_number + 1 - if page_number_next >= 100: - page_number_next_str = str(page_number_next) - elif page_number_next >= 10: - page_number_next_str = '0' + str(page_number_next) - else: - page_number_next_str = '00' + str(page_number_next) - self.next_url = str(self.video_list_page_url).replace(page_number_str, page_number_next_str) - - log("self.next_url", self.next_url) - # # Get the videos... # @@ -73,126 +46,47 @@ def getVideos(self): # # Init # - # thumbnail_urls_index = 0 - list_item = '' - # Create a list for our items. + # Create a list for our items listing = [] # # Get HTML page # - response = requests.get(self.video_list_page_url, headers=HEADERS) + response = requests.get(VIDEO_LIST_PAGE_URL, headers=HEADERS) html_source = response.text html_source = convertToUnicodeString(html_source) - # Parse response - soup = getSoup(html_source) - - # Get video-page-urls - # - # and not - video_page_url_items = soup.findAll('a', attrs={'class': re.compile("^article")}) - - log("len(video_page_url_items", len(video_page_url_items)) - - for video_page_url_item in video_page_url_items: - - log("video_page_url_item", video_page_url_item) - - # - #
- # - #

Pizzaatjes bakken in Pizza Connection - trailer

- - href = video_page_url_item['href'] - - # skip empty video link - if str(href) == '': - - log("skipped empty href", href) - - continue - - # skip video link if starts with '/games/' - if str(href).startswith("/games/"): - - log("skipped href with /games/", href) - - continue - - # skip video link if starts with '/media/gallery/' - if str(href).startswith("/media/gallery/"): - - log("skipped href with /media/gallery/", href) - - continue - - # skip video link if starts with '/artikelen/' - if str(href).startswith("/artikelen/"): - - log("skipped href with /artikelen/", href) - - continue - - video_page_url = "http://www.pu.nl/media/video%s" % href - - log("video_page_url", video_page_url) - - # Make title - # /media/video/pu-tv/parodie-replacer/ - # /media/video/trailer/old-republic-dlc-video-laat-nieuwe-planeet-zien/ - # remove the trailing / - title = str(href) - title = title[0:len(title) - len('/')] - pos_of_last_slash = title.rfind('/') - title = title[pos_of_last_slash + 1:] - title = title.capitalize() - title = title.replace('-', ' ') - title = title.replace('/', ' ') - title = title.replace(' i ', ' I ') - title = title.replace(' ii ', ' II ') - title = title.replace(' iii ', ' III ') - title = title.replace(' iv ', ' IV ') - title = title.replace(' v ', ' V ') - title = title.replace(' vi ', ' VI ') - title = title.replace(' vii ', ' VII ') - title = title.replace(' viii ', ' VIII ') - title = title.replace(' ix ', ' IX ') - title = title.replace(' x ', ' X ') - title = title.replace(' xi ', ' XI ') - title = title.replace(' xii ', ' XII ') - title = title.replace(' xiii ', ' XIII ') - title = title.replace(' xiv ', ' XIV ') - title = title.replace(' xv ', ' XV ') - title = title.replace(' xvi ', ' XVI ') - title = title.replace(' xvii ', ' XVII ') - title = title.replace(' xviii ', ' XVIII ') - title = title.replace(' xix ', ' XIX ') - title = title.replace(' xx ', ' XXX ') - title = title.replace(' xxi ', ' XXI ') - title = title.replace(' xxii ', ' XXII ') - title = title.replace(' xxiii ', ' XXIII ') - title = title.replace(' xxiv ', ' XXIV ') - title = title.replace(' xxv ', ' XXV ') - title = title.replace(' xxvi ', ' XXVI ') - title = title.replace(' xxvii ', ' XXVII ') - title = title.replace(' xxviii ', ' XXVIII ') - title = title.replace(' xxix ', ' XXIX ') - title = title.replace(' xxx ', ' XXX ') - - log("title", title) - - # find thumbnail url - start_pos_src_thumbnail_url = str(video_page_url_item).find('src="') - if start_pos_src_thumbnail_url >= 0: - start_pos_thumbnail_url = start_pos_src_thumbnail_url + len('src="') - end_pos_thumbnail_url = str(video_page_url_item).find('"', start_pos_thumbnail_url) - thumbnail_url = str(video_page_url_item)[start_pos_thumbnail_url:end_pos_thumbnail_url] - else: - thumbnail_url = '' - - log("thumbnail_url", thumbnail_url) + # let's try and select the json containing all the needed data from the web page source + index_start = html_source.find('{"props"') + # log("index", index_start) + index_end = html_source.rfind('}') + # log("index", index_end) + json_data = html_source[index_start:index_end + 1] + # log("json_data", json_data) + + # load the json into the json parser + data = json.loads(json_data) + + # Access the "mp4Url" properties for each video + mp4_urls = [video['video']['video']['mp4Url'] for video in data['props']['pageProps']['_resources']['videos']] + # log("mp4_urls", mp4_urls) + + # Access the "thumbnailUrl" properties for each video + thumbnail_urls = [video['video']['video']['thumbnailUrl'] for video in data['props']['pageProps']['_resources']['videos']] + # log("thumbnail_urls", thumbnail_urls) + + # Access the "title" properties for each video + titles = [video['title'] for video in data['props']['pageProps']['_resources']['videos']] + # log("titles", titles) + + mp4_urls_index = 0 + for mp4_url in mp4_urls: + + log("mp4_url", mp4_url) + title = titles[mp4_urls_index] + thumbnail_url = thumbnail_urls[mp4_urls_index] + video_page_url = mp4_urls[mp4_urls_index] # Add to list list_item = xbmcgui.ListItem(label=title) @@ -208,22 +102,7 @@ def getVideos(self): # Add our item to the listing as a 3-element tuple. listing.append((url, list_item, is_folder)) - # Next page entry - if self.next_page_possible == 'True': - next_page = self.current_page + 1 - thumbnail_url = os.path.join(IMAGES_PATH, 'next-page.png') - list_item = xbmcgui.ListItem(LANGUAGE(30503)) - list_item.setArt({'thumb': thumbnail_url, 'icon': thumbnail_url, - 'fanart': os.path.join(IMAGES_PATH, 'fanart-blur.jpg')}) - list_item.setProperty('IsPlayable', 'false') - parameters = {"action": "list", "plugin_category": self.plugin_category, "url": str(self.next_url), - "next_page_possible": self.next_page_possible} - url = self.plugin_url + '?' + urllib.parse.urlencode(parameters) - is_folder = True - # Add refresh option to context menu - list_item.addContextMenuItems([('Refresh', 'Container.Refresh')]) - # Add our item to the listing as a 3-element tuple. - listing.append((url, list_item, is_folder)) + mp4_urls_index = mp4_urls_index + 1 # Add our listing to Kodi # Large lists and/or slower systems benefit from adding all items at once via addDirectoryItems @@ -232,4 +111,4 @@ def getVideos(self): # Disable sorting xbmcplugin.addSortMethod(handle=self.plugin_handle, sortMethod=xbmcplugin.SORT_METHOD_NONE) # Finish creating a virtual folder. - xbmcplugin.endOfDirectory(self.plugin_handle) + xbmcplugin.endOfDirectory(self.plugin_handle) \ No newline at end of file diff --git a/plugin.video.powerunlimited/resources/lib/powerunlimited_list.pyo b/plugin.video.powerunlimited/resources/lib/powerunlimited_list.pyo deleted file mode 100644 index 0ce01dfa5c..0000000000 Binary files a/plugin.video.powerunlimited/resources/lib/powerunlimited_list.pyo and /dev/null differ diff --git a/plugin.video.powerunlimited/resources/lib/powerunlimited_main.py b/plugin.video.powerunlimited/resources/lib/powerunlimited_main.py deleted file mode 100644 index 748cc682cf..0000000000 --- a/plugin.video.powerunlimited/resources/lib/powerunlimited_main.py +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/env python -# -*- coding: UTF-8 -*- - -# -# Imports -# -from future import standard_library -standard_library.install_aliases() -from builtins import object -import sys -import urllib.request, urllib.parse, urllib.error -import xbmcgui -import xbmcplugin -import os - -from resources.lib.powerunlimited_const import LANGUAGE, IMAGES_PATH - - -# -# Main class -# -class Main(object): - def __init__(self): - # Get the command line arguments - # Get the plugin url in plugin:// notation - self.plugin_url = sys.argv[0] - # Get the plugin handle as an integer number - self.plugin_handle = int(sys.argv[1]) - - # - # Alles - # - parameters = {"action": "list", "plugin_category": LANGUAGE(30000), - "url": "http://www.pu.nl/media/?page=001", "next_page_possible": "True"} - url = self.plugin_url + '?' + urllib.parse.urlencode(parameters) - list_item = xbmcgui.ListItem(LANGUAGE(30000)) - is_folder = True - list_item.setArt({'thumb': 'DefaultFolder.png', 'icon': 'DefaultFolder.png', - 'fanart': os.path.join(IMAGES_PATH, 'fanart-blur.jpg')}) - list_item.setProperty('IsPlayable', 'false') - xbmcplugin.addDirectoryItem(handle=self.plugin_handle, url=url, listitem=list_item, isFolder=is_folder) - - # - # PU-TV - # - parameters = {"action": "list", "plugin_category": LANGUAGE(30001), - "url": "http://www.pu.nl/media/pu-tv/?page=001", "next_page_possible": "True"} - url = self.plugin_url + '?' + urllib.parse.urlencode(parameters) - list_item = xbmcgui.ListItem(LANGUAGE(30001)) - is_folder = True - list_item.setArt({'thumb': 'DefaultFolder.png', 'icon': 'DefaultFolder.png', - 'fanart': os.path.join(IMAGES_PATH, 'fanart-blur.jpg')}) - list_item.setProperty('IsPlayable', 'false') - xbmcplugin.addDirectoryItem(handle=self.plugin_handle, url=url, listitem=list_item, isFolder=is_folder) - - # - # Trailers - # - parameters = {"action": "list", "plugin_category": LANGUAGE(30002), - "url": "http://www.pu.nl/media/trailer/?page=001", "next_page_possible": "True"} - url = self.plugin_url + '?' + urllib.parse.urlencode(parameters) - list_item = xbmcgui.ListItem(LANGUAGE(30002)) - is_folder = True - list_item.setArt({'thumb': 'DefaultFolder.png', 'icon': 'DefaultFolder.png', - 'fanart': os.path.join(IMAGES_PATH, 'fanart-blur.jpg')}) - list_item.setProperty('IsPlayable', 'false') - xbmcplugin.addDirectoryItem(handle=self.plugin_handle, url=url, listitem=list_item, isFolder=is_folder) - - # Disable sorting - xbmcplugin.addSortMethod(handle=self.plugin_handle, sortMethod=xbmcplugin.SORT_METHOD_NONE) - # Finish creating a virtual folder. - xbmcplugin.endOfDirectory(self.plugin_handle) diff --git a/plugin.video.powerunlimited/resources/lib/powerunlimited_main.pyo b/plugin.video.powerunlimited/resources/lib/powerunlimited_main.pyo deleted file mode 100644 index 3f23b414f6..0000000000 Binary files a/plugin.video.powerunlimited/resources/lib/powerunlimited_main.pyo and /dev/null differ diff --git a/plugin.video.powerunlimited/resources/lib/powerunlimited_play.py b/plugin.video.powerunlimited/resources/lib/powerunlimited_play.py index 0772f3d6ce..7fe90814d0 100644 --- a/plugin.video.powerunlimited/resources/lib/powerunlimited_play.py +++ b/plugin.video.powerunlimited/resources/lib/powerunlimited_play.py @@ -6,16 +6,13 @@ # from future import standard_library standard_library.install_aliases() -from builtins import str from builtins import object -from resources.lib.powerunlimited_const import LANGUAGE, HEADERS, convertToUnicodeString, log, getSoup -import re import sys import urllib.request, urllib.parse, urllib.error -import xbmc import xbmcgui import xbmcplugin -import requests + +from resources.lib.powerunlimited_const import log # @@ -45,73 +42,9 @@ def __init__(self): self.playVideo() # - # Play video + # Play video... # def playVideo(self): - # - # Init - # - no_url_found = False - unplayable_media_file = False - have_valid_url = False - dialog_wait = xbmcgui.DialogProgress() - - # - # Get current list item details - # - #title = xbmc.getInfoLabel("listitem.Title") - thumbnail = xbmc.getInfoImage("list_item.Thumb") - #studio = xbmc.getInfoLabel("list_item.Studio") - plot = xbmc.getInfoLabel("list_item.Plot") - genre = xbmc.getInfoLabel("list_item.Genre") - - # - # Get HTML page - # - response = requests.get(self.video_page_url, headers=HEADERS) - - html_source = response.text - html_source = convertToUnicodeString(html_source) - - # Parse response - soup = getSoup(html_source) - - youtube_url = "" - - # Parse video file url - #