summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugin.audio.hearthis_at/addon.py4
-rw-r--r--plugin.audio.hearthis_at/addon.xml4
-rw-r--r--plugin.video.ecbtv/addon.py130
-rw-r--r--plugin.video.ecbtv/addon.xml3
-rw-r--r--plugin.video.ecbtv/resources/language/resource.language.en_gb/strings.po12
-rw-r--r--plugin.video.ecbtv/resources/lib/api.py152
-rw-r--r--plugin.video.hak5/addon.xml4
-rw-r--r--plugin.video.hak5/changelog.txt3
-rw-r--r--plugin.video.hak5/resources/lib/hak5_const.py4
-rw-r--r--plugin.video.hak5/resources/lib/hak5_list_episodes.py49
-rw-r--r--plugin.video.hak5/resources/lib/hak5_list_seasons.py7
-rw-r--r--plugin.video.hak5/resources/lib/hak5_main.py2
-rw-r--r--plugin.video.hak5/resources/lib/hak5_play.py25
13 files changed, 278 insertions, 121 deletions
diff --git a/plugin.audio.hearthis_at/addon.py b/plugin.audio.hearthis_at/addon.py
index daf66f7..f1f4e63 100644
--- a/plugin.audio.hearthis_at/addon.py
+++ b/plugin.audio.hearthis_at/addon.py
@@ -86,9 +86,7 @@ def list_users(userlist, pagination = None, first=False, pre=[], post=[]):
for u in userlist:
items.append({'label': '%s%s (%s %s)' % ((u'[\u2665] ' if u.get('following', False) else u''), u['username'], str(u['track_count']), _('tracks')),
'icon': u['avatar_url'],
- 'context_menu': [
- context_item_toggle('follow', u['following'], {'user': u['permalink']})
- ],
+ 'context_menu': context_item_toggle('follow', u['following'], {'user': u['permalink']}),
'path': plugin.url_for('show_user_first', user=u['permalink'], page=1, first=True)})
items = items + post
items.append(pn_button(pagination, 1, len(userlist)))
diff --git a/plugin.audio.hearthis_at/addon.xml b/plugin.audio.hearthis_at/addon.xml
index baa6bb6..4477d9e 100644
--- a/plugin.audio.hearthis_at/addon.xml
+++ b/plugin.audio.hearthis_at/addon.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<addon id="plugin.audio.hearthis_at" name="Hearthis.at" version="1.0.2" provider-name="Eike Baran">
+<addon id="plugin.audio.hearthis_at" name="Hearthis.at" version="1.0.3" provider-name="Eike Baran">
<requires>
<import addon="xbmc.python" version="2.25.0" />
<import addon="script.module.kodiswift" version="0.0.1" />
@@ -19,6 +19,8 @@
<description lang="de_DE">Hearthis.at ist eine Online-Musikplattform, auf welcher Nutzer ihre Werke hochladen, aufnehmen, bewerben und teilen können. Dieses Addon erlaubt Zugriff auf die wichtigsten Funktionen der Plattform um diese Inhalte abzurufen.</description>
<disclaimer lang="en_GB">Use at own risk. Code may be faulty, clog your drain or kill your cat.</disclaimer>
<news>
+v1.0.3 (2017-08-15)
+- fixed search for artists
v1.0.2 (2017-07-22)
- fixed bug that would prevent non-logged-in users from using the addon
v1.0.1 (2017-07-21)
diff --git a/plugin.video.ecbtv/addon.py b/plugin.video.ecbtv/addon.py
index fc87873..03f86f0 100644
--- a/plugin.video.ecbtv/addon.py
+++ b/plugin.video.ecbtv/addon.py
@@ -29,16 +29,60 @@ from kodiswift import Plugin
from resources.lib import api
-plugin = Plugin()
+PAGE_SIZE = 9
+plugin = Plugin(addon_id='plugin.video.ecbtv')
+
+
+def top_level_categories():
+ yield {'label': u'[B]{}[/B]'.format(plugin.get_string(30002)),
+ 'path': plugin.url_for('show_all_videos_first_page')}
+ yield {'label': u'[B]{}[/B]'.format(plugin.get_string(30001)),
+ 'path': plugin.url_for('search')}
+ yield {'label': 'England',
+ 'path': plugin.url_for('show_videos_by_reference_first_page',
+ reference=api.england().reference)}
+ yield {'label': 'Counties',
+ 'path': plugin.url_for('show_counties')}
+ yield {'label': 'Players',
+ 'path': plugin.url_for('show_player_categories')}
+
+
+def subcategories(categories, route):
+ for category in categories:
+ yield {'label': category.name,
+ 'thumbnail': category.thumbnail,
+ 'path': plugin.url_for(route, category=category.name)}
+
+
+def entity_items(entities):
+ for entity in entities:
+ yield {'label': entity.name,
+ 'thumbnail': entity.thumbnail,
+ 'path': plugin.url_for('show_videos_by_reference_first_page',
+ reference=entity.reference)}
+
+
+def items(func, route, page, **kwargs):
+ videos, npages = func(page=page, page_size=PAGE_SIZE, **kwargs)
+
+ if page > 1:
+ yield {
+ 'label': u'[B]<< {} ({})[/B]'.format(plugin.get_string(30003), page - 1),
+ 'path': plugin.url_for(route, page=page - 1, **kwargs)
+ }
+ if page < npages:
+ yield {
+ 'label': u'[B]{} ({}) >> [/B]'.format(plugin.get_string(30004), page + 1),
+ 'path': plugin.url_for(route, page=page + 1, **kwargs)
+ }
-def items(videos):
for video in videos:
yield {
+ 'label': video.title,
'thumbnail': video.thumbnail,
'path': video.url,
'info': {
- 'title': video.title,
'date': video.date.strftime('%d.%m.%Y'),
'duration': video.duration
},
@@ -46,41 +90,77 @@ def items(videos):
}
-def categories():
- yield {'label': "[B]{}[/B]".format(plugin.get_string(30001)),
- 'path': plugin.url_for('search')}
- for title, path in api.categories():
- yield {'label': title, 'path': plugin.url_for('show_videos', path=path)}
+def show_videos(func, route, page, update_listing, **kwargs):
+ return plugin.finish(
+ items(func, route, page, **kwargs),
+ sort_methods=['playlist_order', 'date', 'title', 'duration'],
+ update_listing=update_listing
+ )
+
+
+@plugin.cached()
+def counties():
+ return list(api.counties())
-@plugin.route('/')
+@plugin.cached()
+def player_categories():
+ return list(api.player_categories())
+
+
+@plugin.cached()
+def players(category):
+ return list(api.players(category))
+
+
+@plugin.cached_route('/')
def index():
- return plugin.finish(categories())
+ return list(top_level_categories())
+
+@plugin.route('/counties', name='show_counties', options={'func': counties})
+def show_entities(func):
+ return plugin.finish(entity_items(func()), sort_methods=['label'])
-@plugin.route('/category/<path>')
-def show_videos(path):
+
+@plugin.route('/players')
+def show_player_categories():
return plugin.finish(
- items(api.videos(path)),
- sort_methods=['playlist_order', 'date', 'title', 'duration']
+ subcategories(player_categories(), 'show_players'),
+ sort_methods=['label']
)
+@plugin.route('/players/<category>')
+def show_players(category):
+ return plugin.finish(entity_items(players(category)), sort_methods=['label'])
+
+
+@plugin.route('/videos/all', name='show_all_videos_first_page', options={'update_listing': False})
+@plugin.route('/videos/all/<page>')
+def show_all_videos(page='1', update_listing=True):
+ return show_videos(api.videos, 'show_all_videos', int(page), update_listing)
+
+
+@plugin.route('/videos/<reference>', name='show_videos_by_reference_first_page', options={'update_listing': False})
+@plugin.route('/videos/<reference>/<page>')
+def show_videos_by_reference(reference, page='1', update_listing=True):
+ return show_videos(api.videos, 'show_videos_by_reference', int(page), update_listing, reference=reference)
+
+
+@plugin.route('/search/<term>', name='show_search_results_first_page', options={'update_listing': False})
+@plugin.route('/search/<term>/<page>')
+def show_search_results(term, page='1', update_listing=True):
+ return show_videos(api.search_results, 'show_search_results', int(page), update_listing, term=term)
+
+
@plugin.route('/search')
def search():
- query = plugin.keyboard(heading=plugin.get_string(30001))
- if query:
- url = plugin.url_for('search_result', query=query)
+ term = plugin.keyboard(heading=plugin.get_string(30001))
+ if term:
+ url = plugin.url_for('show_search_results_first_page', term=term)
plugin.redirect(url)
-@plugin.route('/search/<query>')
-def search_result(query):
- return plugin.finish(
- items(api.search_results(query, size=11)),
- sort_methods=['playlist_order', 'date', 'title', 'duration']
- )
-
-
if __name__ == '__main__':
plugin.run()
diff --git a/plugin.video.ecbtv/addon.xml b/plugin.video.ecbtv/addon.xml
index d9a66c6..89e2c17 100644
--- a/plugin.video.ecbtv/addon.xml
+++ b/plugin.video.ecbtv/addon.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<addon id="plugin.video.ecbtv" name="ECB TV" version="0.3.0" provider-name="Leopold">
+<addon id="plugin.video.ecbtv" name="ECB TV" version="0.5.0" provider-name="Leopold">
<requires>
<import addon="xbmc.python" version="2.25.0"/>
<import addon="script.module.kodiswift" version="0.0.8" optional="false"/>
@@ -21,5 +21,6 @@
<icon>resources/icon.png</icon>
<fanart>resources/fanart.jpg</fanart>
</assets>
+ <news>Fixed and improved video browsing after website changes.</news>
</extension>
</addon>
diff --git a/plugin.video.ecbtv/resources/language/resource.language.en_gb/strings.po b/plugin.video.ecbtv/resources/language/resource.language.en_gb/strings.po
index f7b1d15..646d379 100644
--- a/plugin.video.ecbtv/resources/language/resource.language.en_gb/strings.po
+++ b/plugin.video.ecbtv/resources/language/resource.language.en_gb/strings.po
@@ -19,3 +19,15 @@ msgstr ""
msgctxt "#30001"
msgid "Search"
msgstr ""
+
+msgctxt "#30002"
+msgid "All"
+msgstr ""
+
+msgctxt "#30003"
+msgid "Previous Page"
+msgstr ""
+
+msgctxt "#30004"
+msgid "Next Page"
+msgstr ""
diff --git a/plugin.video.ecbtv/resources/lib/api.py b/plugin.video.ecbtv/resources/lib/api.py
index 6f57dcd..c8072c8 100644
--- a/plugin.video.ecbtv/resources/lib/api.py
+++ b/plugin.video.ecbtv/resources/lib/api.py
@@ -28,38 +28,55 @@
Module for extracting video links from the England and Wales Cricket Board website
'''
-import json
import os
+import re
from urlparse import urljoin, urlparse, urlunparse
from urllib import urlencode
from datetime import datetime
import time
from collections import namedtuple
+import math
import requests
from bs4 import BeautifulSoup
-HOST = 'http://www.ecb.co.uk'
-BASE_URL = urljoin(HOST, 'tv/')
+
+BASE_URL = 'http://www.ecb.co.uk/'
HLS_HOST = 'https://secure.brightcove.com/'
HLS_URL_FMT = urljoin(HLS_HOST, 'services/mobile/streaming/index/master.m3u8?videoId={}')
-SEARCH_URL = 'https://content-ecb.pulselive.com/search/ecb/'
+PLAYER_THUMB_URL_FMT = 'https://ecb-resources.s3.amazonaws.com/player-photos/{}/480x480/{}.png'
+SEARCH_URL = 'https://content-ecb.pulselive.com/search/ecb/'
+VIDEO_LIST_URL = 'https://content-ecb.pulselive.com/content/ecb/EN/'
Video = namedtuple('Video', 'title url thumbnail date duration')
+Entity = namedtuple('Entity', 'name reference thumbnail')
+
+
+def _video_list_url(reference, page, page_size=10):
+ '''Returns a URL for a list of videos'''
+ url_parts = list(urlparse(VIDEO_LIST_URL))
+ query_params = dict(
+ contentTypes='video',
+ references=reference if reference is not None else '',
+ page=page - 1,
+ pageSize=page_size
+ )
+ url_parts[4] = urlencode(query_params)
+ return urlunparse(url_parts)
-def _search_url(term, start, size):
+def _search_url(term, page, page_size=10):
'''Returns a URL for the JSON search api'''
url_parts = list(urlparse(SEARCH_URL))
query_params = dict(
type='VIDEO',
fullObjectResponse=True,
terms=term,
- size=size,
- start=start
+ size=page_size,
+ start=(page - 1) * page_size
)
url_parts[4] = urlencode(query_params)
return urlunparse(url_parts)
@@ -78,12 +95,6 @@ def _date_from_str(date_str, fmt='%d %B %Y'):
return datetime(*(time.strptime(date_str, fmt)[0:6])).date()
-def _date(media_item):
- '''Returns a date object from the HTML media item.'''
- date_str = media_item.find('time', 'media__sub-meta').string
- return _date_from_str(date_str)
-
-
def _date_json(json_item):
'''Returns a date object from the JSON item.
The date can be one of two formats'''
@@ -98,60 +109,107 @@ def _date_json(json_item):
raise exc
-def categories():
- '''Generator for category names and links, excluding all that appear before Home'''
- start = False
- for submenu_link in _soup()('a', 'submenu__link'):
- title = submenu_link.string.strip()
- if start and title != 'All Categories':
- yield title, os.path.basename(submenu_link['href'])
- if title == 'Home':
- start = True
+def _thumbnail_variant(video):
+ if video['thumbnail'] is None:
+ return
+ return (variant['url'] for variant in video['thumbnail']['variants']
+ if variant['tag']['id'] == 981).next()
-def videos(path):
- '''Generator for all videos from a particular page'''
- for media_item in _soup(path)('a', 'media__item'):
- video = json.loads(media_item['data-ui-args'])
- yield Video(
- title=media_item.find('span', 'media__title').string,
- url=HLS_URL_FMT.format(video['mediaId']),
- thumbnail=media_item.picture.img['data-highres-img'],
- date=_date(media_item),
- duration=int(video['duration'].replace(',', ''))
+def england():
+ return Entity(
+ name='England',
+ reference='cricket_team:11',
+ thumbnail=None
+ )
+
+
+def counties():
+ for county in _soup('/county-championship/teams')('div', 'partners__item'):
+ team_id = int(os.path.basename(county.a['href']))
+ yield Entity(
+ name=county.a.text,
+ reference='cricket_team:{}'.format(team_id),
+ thumbnail=county.img['src']
+ )
+
+
+def player_categories():
+ for tab in _soup('/england/men/players').find_all(
+ 'div', attrs={'data-ui-args': re.compile(r'{ "title": "\w+" }')}):
+ yield Entity(
+ name=tab['data-ui-tab'],
+ reference=None,
+ thumbnail=None
+ )
+
+
+def players(category='Test'):
+ soup = _soup('/england/men/players').find('div', attrs={'data-ui-tab': category})
+ for player in soup('section', 'profile-player-card'):
+ player_id = player.img['data-player']
+ yield Entity(
+ name=player.img['alt'],
+ reference='cricket_player:{}'.format(player_id),
+ thumbnail=PLAYER_THUMB_URL_FMT.format(category.lower(), player_id)
)
-def search_results(term, start=0, size=10):
+def _video(video):
+ return Video(
+ title=video['title'],
+ url=HLS_URL_FMT.format(video['mediaId']),
+ thumbnail=_thumbnail_variant(video),
+ date=_date_json(video),
+ duration=video['duration']
+ )
+
+
+def _videos(videos_json):
+ '''Generator for all videos from a particular page'''
+ for video in videos_json['content']:
+ yield _video(video)
+
+
+def videos(reference=None, page=1, page_size=10):
+ videos_json = requests.get(_video_list_url(reference, page, page_size)).json()
+ npages = videos_json['pageInfo']['numPages']
+ return _videos(videos_json), npages
+
+
+def _search_results(search_results_json):
'''Generator for videos matching a search term'''
- results = requests.get(_search_url(term, start, size)).json()['hits']['hit']
+ results = search_results_json['hits']['hit']
for result in results:
video = result['response']
- yield Video(
- title=video['title'],
- url=HLS_URL_FMT.format(video['mediaId']),
- thumbnail=video['imageUrl'],
- date=_date_json(video),
- duration=video['duration']
- )
+ yield _video(video)
+
+
+def search_results(term, page=1, page_size=10):
+ search_results_json = requests.get(_search_url(term, page, page_size)).json()
+ total = search_results_json['hits']['found']
+ npages = int(math.ceil(float(total) / page_size))
+ return _search_results(search_results_json), npages
-def _print_all_videos():
+def _print_team_videos():
'''Test function to print all categories and videos'''
- for title, path in categories():
- print '{} ({})'.format(title, path)
- for video in videos(path):
+ for team in [england()] + list(counties()):
+ print '{} ({})'.format(team.name, team.reference)
+ videos_page, _num_pages = videos(team.reference)
+ for video in videos_page:
print '\t', video.title
def _print_search_results(term):
'''Test function to print search results'''
print 'Search: {}'.format(term)
- for video in search_results(term):
+ videos_page, _num_pages = search_results(term)
+ for video in videos_page:
print '\t', video.title
if __name__ == '__main__':
- _print_all_videos()
+ _print_team_videos()
print
_print_search_results('test cricket')
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 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.hak5"
name="Hak5"
- version="1.0.1"
+ version="1.0.2"
provider-name="Skipmode A1">
<requires>
<import addon="xbmc.python" version="2.25.0"/>
@@ -14,7 +14,7 @@
</extension>
<extension point="xbmc.addon.metadata">
<summary lang="en_GB">Watch videos from hak5.com</summary>
- <description lang="en_GB">Watch videos from hak5.com. The videos are from the shows Hak5, Haktik, Threatwire, Tekthing, Pineapple University and Metasploit</description>
+ <description lang="en_GB">Watch videos from hak5.com. The videos are from the shows Hak5, Haktik, Threatwire, Tekthing and Metasploit</description>
<disclaimer lang="en_GB">For bugs, requests or general questions visit the hak5.com thread on the Kodi forum</disclaimer>
<language>en</language>
<platform>all</platform>
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)
+ # <div id="post-8843" class="video-item post-8843 post type-post status-publish format-video has-post-thumbnail hentry category-episodes category-hak5 category-season-22 tag-darren-kitchen tag-hack-across-the-planet tag-hak-5 tag-pseudocode-for-life post_format-post-format-video">
# <div class="item-thumbnail">
- # <a href="https://www.hak5.org/episodes/3-billion-yahoo-accounts-hacked-disqus-hacked-threat-wire">
- # <img width="520" height="293" src="https://www.hak5.org/wp-content/uploads/2017/10/3-billion-yahoo-accounts-hacked-520x293.jpg" class="attachment-thumb_520x293 size-thumb_520x293 wp-post-image" alt="" srcset="https://www.hak5.org/wp-content/uploads/2017/10/3-billion-yahoo-accounts-hacked-520x293.jpg 520w, https://www.hak5.org/wp-content/uploads/2017/10/3-billion-yahoo-accounts-hacked-150x84.jpg 150w, https://www.hak5.org/wp-content/uploads/2017/10/3-billion-yahoo-accounts-hacked-300x169.jpg 300w, https://www.hak5.org/wp-content/uploads/2017/10/3-billion-yahoo-accounts-hacked-1024x576.jpg 1024w, https://www.hak5.org/wp-content/uploads/2017/10/3-billion-yahoo-accounts-hacked-260x146.jpg 260w, https://www.hak5.org/wp-content/uploads/2017/10/3-billion-yahoo-accounts-hacked-356x200.jpg 356w, https://www.hak5.org/wp-content/uploads/2017/10/3-billion-yahoo-accounts-hacked-370x208.jpg 370w, https://www.hak5.org/wp-content/uploads/2017/10/3-billion-yahoo-accounts-hacked-180x101.jpg 180w, https://www.hak5.org/wp-content/uploads/2017/10/3-billion-yahoo-accounts-hacked-130x73.jpg 130w, https://www.hak5.org/wp-content/uploads/2017/10/3-billion-yahoo-accounts-hacked-748x421.jpg 748w, https://www.hak5.org/wp-content/uploads/2017/10/3-billion-yahoo-accounts-hacked-624x351.jpg 624w, https://www.hak5.org/wp-content/uploads/2017/10/3-billion-yahoo-accounts-hacked.jpg 1280w" sizes="(max-width: 520px) 100vw, 520px" /> <div class="link-overlay fa fa-search"></div>
+ # <a href="https://www.hak5.org/episodes/hak5-2216-pseudocode-for-life-2-hack-across-the-planet">
+ # <img width="520" height="293" src="https://www.hak5.org/wp-content/uploads/2017/06/hak5-2216-pseudocode-for-life-2-520x293.jpg" class="attachment-thumb_520x293 size-thumb_520x293 wp-post-image" alt="" srcset="https://www.hak5.org/wp-content/uploads/2017/06/hak5-2216-pseudocode-for-life-2-520x293.jpg 520w, https://www.hak5.org/wp-content/uploads/2017/06/hak5-2216-pseudocode-for-life-2-150x84.jpg 150w, https://www.hak5.org/wp-content/uploads/2017/06/hak5-2216-pseudocode-for-life-2-300x169.jpg 300w, https://www.hak5.org/wp-content/uploads/2017/06/hak5-2216-pseudocode-for-life-2-1024x576.jpg 1024w, https://www.hak5.org/wp-content/uploads/2017/06/hak5-2216-pseudocode-for-life-2-260x146.jpg 260w, https://www.hak5.org/wp-content/uploads/2017/06/hak5-2216-pseudocode-for-life-2-356x200.jpg 356w, https://www.hak5.org/wp-content/uploads/2017/06/hak5-2216-pseudocode-for-life-2-370x208.jpg 370w, https://www.hak5.org/wp-content/uploads/2017/06/hak5-2216-pseudocode-for-life-2-180x101.jpg 180w, https://www.hak5.org/wp-content/uploads/2017/06/hak5-2216-pseudocode-for-life-2-130x73.jpg 130w, https://www.hak5.org/wp-content/uploads/2017/06/hak5-2216-pseudocode-for-life-2-748x421.jpg 748w, https://www.hak5.org/wp-content/uploads/2017/06/hak5-2216-pseudocode-for-life-2-624x351.jpg 624w, https://www.hak5.org/wp-content/uploads/2017/06/hak5-2216-pseudocode-for-life-2.jpg 1280w" sizes="(max-width: 520px) 100vw, 520px" /> <div class="link-overlay fa fa-play"></div>
# </a>
# </div>
# <div class="item-head">
- # <h3><a href="https://www.hak5.org/episodes/3-billion-yahoo-accounts-hacked-disqus-hacked-threat-wire" rel="9479" title="3 Billion Yahoo Accounts Hacked; Disqus Hacked! – Threat Wire">3 Billion Yahoo Accounts Hacked; Disqus Hacked! &#8211; Threat Wire</a>
+ # <h3><a href="https://www.hak5.org/episodes/hak5-2216-pseudocode-for-life-2-hack-across-the-planet" rel="8843" title="Hak5 2216 – Pseudocode for Life 2 – Hack Across the Planet">Hak5 2216 &#8211; Pseudocode for Life 2 &#8211; Hack Across the Planet</a>
# </h3>
# <div class="item-info hidden">
# <span class="item-author"><a href="https://www.hak5.org/author/snubs" title="Posts by Shannon Morse" rel="author">Shannon Morse</a></span>
- # <span class="item-date">October 10, 2017</span>
+ # <span class="item-date">June 28, 2017</span>
# <div class="item-meta">
- # <span><i class="fa fa-eye"></i> 0</span> <span><i class="fa fa-comment"></i> 0</span> <span><i class="fa fa-thumbs-up"></i> 0</span>
+ # <span><i class="fa fa-eye"></i> 0</span> <span><i class="fa fa-comment"></i> 0</span> <span><i class="fa fa-thumbs-up"></i> 1</span>
# </div>
# </div>
# </div>
# <div class="item-content hidden">
- # <p>The Yahoo breach was a lot worse than we thought, the Equifax ex-CEO sheds light on some questions, disqus was hacked, and Kaspersky is stuck in the middle of debates. All that coming up now on ThreatWire. Hak5 Product Launch Event! October 20th: https://www.hak5.org/rsvp &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- Shop: http://www.hakshop.com Support: http://www.patreon.com/threatwire Subscribe: http://www.youtube.com/hak5 Our Site: http://www.hak5.org [&hellip;]</p>
+ # <p>It&#8217;s better to regret something you have done than something you haven&#8217;t. Regular episodes resume August 2nd. UK meetups July 10-14. Sign up at https://HackAcrossThePlanet.com https://HackAcrossThePlanet.com &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- Shop: http://www.hakshop.com Support: http://www.patreon.com/threatwire Subscribe: http://www.youtube.com/hak5 Our Site: http://www.hak5.org Contact Us: http://www.twitter.com/hak5 Threat Wire RSS: https://shannonmorse.podbean.com/feed/ Threat Wire iTunes: https://itunes.apple.com/us/podcast/threat-wire/id1197048999 Help us with Translations! http://www.youtube.com/timedtext_cs_panel?tab=2&#038;c=UC3s0BtrBJpwNDaflRSoiieQ &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
# </div>
# <div class="clearfix"></div>
# </div>
@@ -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('<span>')
- blog_date_day_end_pos = blog_date.find('</span>')
- blog_date_day = blog_date[blog_date_day_start_pos + len('<span>'):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
- # <meta property="og:url" content="https://youtu.be/K_EOLgX5Dqs"/>
+ #<iframe width="900" height="506" src="https://www.youtube.com/embed/fYdFNFTSoy4?feature=oembed&#038;wmode=opaque&#038;rel=0&#038;showinfo=0&#038;modestbranding=0"
+ # frameborder="0" gesture="media" allowfullscreen></iframe>
+
# 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)