From 5694665bd5c2aacc3b67de0a3c6ea40fbc782e3e Mon Sep 17 00:00:00 2001 From: skipmodea1 Date: Sun, 12 Nov 2017 09:42:21 +0100 Subject: [plugin.video.hak5] 1.0.2 --- plugin.video.hak5/addon.xml | 4 +- plugin.video.hak5/changelog.txt | 3 ++ plugin.video.hak5/resources/lib/hak5_const.py | 4 +- .../resources/lib/hak5_list_episodes.py | 49 ++++++++++++---------- .../resources/lib/hak5_list_seasons.py | 7 ++-- plugin.video.hak5/resources/lib/hak5_main.py | 2 +- plugin.video.hak5/resources/lib/hak5_play.py | 25 +++++------ 7 files changed, 50 insertions(+), 44 deletions(-) diff --git a/plugin.video.hak5/addon.xml b/plugin.video.hak5/addon.xml index 416f26e..efafba7 100644 --- a/plugin.video.hak5/addon.xml +++ b/plugin.video.hak5/addon.xml @@ -1,7 +1,7 @@  @@ -14,7 +14,7 @@ Watch videos from hak5.com - Watch videos from hak5.com. The videos are from the shows Hak5, Haktik, Threatwire, Tekthing, Pineapple University and Metasploit + Watch videos from hak5.com. The videos are from the shows Hak5, Haktik, Threatwire, Tekthing and Metasploit For bugs, requests or general questions visit the hak5.com thread on the Kodi forum en all diff --git a/plugin.video.hak5/changelog.txt b/plugin.video.hak5/changelog.txt index de23b40..213d41d 100644 --- a/plugin.video.hak5/changelog.txt +++ b/plugin.video.hak5/changelog.txt @@ -1,3 +1,6 @@ +v1.0.2 (2017-11-12) +Fixes due to website changes + v1.0.1 (2017-10-11) Fixes due to website changes Removed Pinapple University videos diff --git a/plugin.video.hak5/resources/lib/hak5_const.py b/plugin.video.hak5/resources/lib/hak5_const.py index 83ad2bd..0334942 100644 --- a/plugin.video.hak5/resources/lib/hak5_const.py +++ b/plugin.video.hak5/resources/lib/hak5_const.py @@ -19,5 +19,5 @@ TEKTHINGRECENTLYADDEDURL = 'http://www.hak5.org/category/episodes/tekthing/page/ PINEAPPLEUNIVERSITYRECENTLYADDEDURL = 'http://www.hak5.org/category/episodes/pineapple-university' METASPLOITRECENTLYADDEDURL = 'http://www.hak5.org/category/episodes/metasploit-minute/page/001' 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 = "2017-10-11" -VERSION = "1.0.1" \ No newline at end of file +DATE = "2017-11-12" +VERSION = "1.0.2" \ No newline at end of file diff --git a/plugin.video.hak5/resources/lib/hak5_list_episodes.py b/plugin.video.hak5/resources/lib/hak5_list_episodes.py index 6c95be1..fe8192f 100644 --- a/plugin.video.hak5/resources/lib/hak5_list_episodes.py +++ b/plugin.video.hak5/resources/lib/hak5_list_episodes.py @@ -95,24 +95,25 @@ class Main: # xbmc.log("[ADDON] %s v%s (%s) debug mode, %s = %s" % ( # ADDON, VERSION, DATE, "html_source", str(html_source)), xbmc.LOGDEBUG) + #
# # # #
#
@@ -124,8 +125,8 @@ class Main: for episode in episodes: - xbmc.log("[ADDON] %s v%s (%s) debug mode, %s = %s" % ( - ADDON, VERSION, DATE, "episode)", str(episode)), xbmc.LOGDEBUG) + # xbmc.log("[ADDON] %s v%s (%s) debug mode, %s = %s" % ( + # ADDON, VERSION, DATE, "episode", str(episode)), xbmc.LOGDEBUG) video_page_url = episode.a['href'] @@ -208,29 +209,33 @@ class Main: blog_date_year = blog_date[blog_date_year_start_pos: blog_date_year_end_pos] xbmc.log("[ADDON] %s v%s (%s) debug mode, %s = %s" % ( - ADDON, VERSION, DATE, "blog_date_year)", str(blog_date_year)), xbmc.LOGDEBUG) + ADDON, VERSION, DATE, "blog_date_year", str(blog_date_year)), xbmc.LOGDEBUG) blog_date_month_start_pos = blog_date_year_end_pos + 1 blog_date_month_end_pos = blog_date_month_start_pos + 2 blog_date_month = blog_date[blog_date_month_start_pos:blog_date_month_end_pos] xbmc.log("[ADDON] %s v%s (%s) debug mode, %s = %s" % ( - ADDON, VERSION, DATE, "blog_date_month)", str(blog_date_month)), xbmc.LOGDEBUG) + ADDON, VERSION, DATE, "blog_date_month", str(blog_date_month)), xbmc.LOGDEBUG) # lets find the blog date day - blog_date = episode.findAll('div', attrs={'class': re.compile("^" + 'blog-date')}) - blog_date = str(blog_date) - blog_date_day_start_pos = blog_date.find('') - blog_date_day_end_pos = blog_date.find('') - blog_date_day = blog_date[blog_date_day_start_pos + len(''):blog_date_day_end_pos] + blog_date = episode.findAll('span', attrs={'class': re.compile("^" + 'item-date')}) - xbmc.log("[ADDON] %s v%s (%s) debug mode, %s = %s" % ( - ADDON, VERSION, DATE, "blog_date_day)", str(blog_date_day)), xbmc.LOGDEBUG) + if len(blog_date) == 0: + blog_date_day = '00' + else: + blog_date = str(blog_date[0].text) + blog_date_day_start_pos = blog_date.find(',') - 2 + blog_date_day_end_pos = blog_date_day_start_pos + 2 + blog_date_day = blog_date[blog_date_day_start_pos:blog_date_day_end_pos] + + xbmc.log("[ADDON] %s v%s (%s) debug mode, %s = %s" % ( + ADDON, VERSION, DATE, "blog_date_day", str(blog_date_day)), xbmc.LOGDEBUG) video_date = blog_date_year + '-' + blog_date_month + '-' + blog_date_day + ' 00:00:01' xbmc.log("[ADDON] %s v%s (%s) debug mode, %s = %s" % ( - ADDON, VERSION, DATE, "video_date)", str(video_date)), xbmc.LOGDEBUG) + ADDON, VERSION, DATE, "video_date", str(video_date)), xbmc.LOGDEBUG) # Unescaping the plot try: @@ -238,6 +243,8 @@ class Main: except: plot = title + xbmc.log("[ADDON] %s v%s (%s) debug mode, %s = %s" % (ADDON, VERSION, DATE, "plot", str(plot)), xbmc.LOGDEBUG) + add_sort_methods() context_menu_items = [] @@ -286,6 +293,6 @@ class Main: xbmcplugin.endOfDirectory(self.plugin_handle) def add_sort_methods(): - sort_methods = [xbmcplugin.SORT_METHOD_UNSORTED,xbmcplugin.SORT_METHOD_LABEL,xbmcplugin.SORT_METHOD_DATE,xbmcplugin.SORT_METHOD_DURATION,xbmcplugin.SORT_METHOD_EPISODE] - for method in sort_methods: - xbmcplugin.addSortMethod(int(sys.argv[1]), sortMethod=method) + sort_methods = [xbmcplugin.SORT_METHOD_UNSORTED,xbmcplugin.SORT_METHOD_LABEL,xbmcplugin.SORT_METHOD_DATE,xbmcplugin.SORT_METHOD_DURATION,xbmcplugin.SORT_METHOD_EPISODE] + for method in sort_methods: + xbmcplugin.addSortMethod(int(sys.argv[1]), sortMethod=method) \ No newline at end of file diff --git a/plugin.video.hak5/resources/lib/hak5_list_seasons.py b/plugin.video.hak5/resources/lib/hak5_list_seasons.py index 9b3388e..f2d37dc 100644 --- a/plugin.video.hak5/resources/lib/hak5_list_seasons.py +++ b/plugin.video.hak5/resources/lib/hak5_list_seasons.py @@ -137,7 +137,8 @@ class Main: # Finish creating a virtual folder. xbmcplugin.endOfDirectory(self.plugin_handle) + def add_sort_methods(): - sort_methods = [xbmcplugin.SORT_METHOD_UNSORTED,xbmcplugin.SORT_METHOD_LABEL,xbmcplugin.SORT_METHOD_DATE,xbmcplugin.SORT_METHOD_DURATION,xbmcplugin.SORT_METHOD_EPISODE] - for method in sort_methods: - xbmcplugin.addSortMethod(int(sys.argv[1]), sortMethod=method) \ No newline at end of file + sort_methods = [xbmcplugin.SORT_METHOD_UNSORTED,xbmcplugin.SORT_METHOD_LABEL,xbmcplugin.SORT_METHOD_DATE,xbmcplugin.SORT_METHOD_DURATION,xbmcplugin.SORT_METHOD_EPISODE] + for method in sort_methods: + xbmcplugin.addSortMethod(int(sys.argv[1]), sortMethod=method) \ No newline at end of file diff --git a/plugin.video.hak5/resources/lib/hak5_main.py b/plugin.video.hak5/resources/lib/hak5_main.py index af47c11..f1c2105 100644 --- a/plugin.video.hak5/resources/lib/hak5_main.py +++ b/plugin.video.hak5/resources/lib/hak5_main.py @@ -89,7 +89,7 @@ class Main: # Metasploit Recently Added Episodes # parameters = {"action": "list-episodes", "plugin_category": LANGUAGE(30307), "url": METASPLOITRECENTLYADDEDURL, - "next_page_possible": "True"} + "next_page_possible": "False"} url = self.plugin_url + '?' + urllib.urlencode(parameters) list_item = xbmcgui.ListItem(LANGUAGE(30307)) is_folder = True diff --git a/plugin.video.hak5/resources/lib/hak5_play.py b/plugin.video.hak5/resources/lib/hak5_play.py index 685a992..7e0f93d 100644 --- a/plugin.video.hak5/resources/lib/hak5_play.py +++ b/plugin.video.hak5/resources/lib/hak5_play.py @@ -82,23 +82,18 @@ class Main: no_url_found = True have_valid_url = False - # + # + # let's extract the youtube-id html_source = str(html_source) - start_pos_meta_prop = html_source.find('meta property="og:url"') - if start_pos_meta_prop > 0: - search_for_string = '"/>' - end_pos_meta_prop = html_source.find(search_for_string, start_pos_meta_prop) - if end_pos_meta_prop > 0: - # the last 3 characters are removed - meta_prop = html_source[start_pos_meta_prop: end_pos_meta_prop] - - xbmc.log("[ADDON] %s v%s (%s) debug mode, %s = %s" % ( - ADDON, VERSION, DATE, "meta_prop", str(meta_prop)), xbmc.LOGDEBUG) - - pos_of_last_slash = meta_prop.rfind('/') - youtube_id = meta_prop[pos_of_last_slash + 1:] - + start_pos_youtube_embed = html_source.find('youtube.com/embed/') + if start_pos_youtube_embed > 0: + start_pos_youtube_id = start_pos_youtube_embed + len('youtube.com/embed/') + search_for_string = '?' + end_pos_youtube_id = html_source.find(search_for_string, start_pos_youtube_id) + if end_pos_youtube_id > 0: + youtube_id = html_source[start_pos_youtube_id:end_pos_youtube_id] xbmc.log("[ADDON] %s v%s (%s) debug mode, %s = %s" % ( ADDON, VERSION, DATE, "youtube_id", str(youtube_id)), xbmc.LOGDEBUG) -- cgit v1.2.3