summaryrefslogtreecommitdiff
path: root/plugin.video.hak5/resources/lib/hak5_list_episodes.py
diff options
context:
space:
mode:
authorskipmodea1 <skipmodea1@outlook.com>2017-11-12 09:42:21 +0100
committerMartijn Kaijser <martijn@xbmc.org>2017-11-12 10:05:06 +0100
commit5694665bd5c2aacc3b67de0a3c6ea40fbc782e3e (patch)
treeb07871584ba7f1927eda92c6b1e18bdf0a595458 /plugin.video.hak5/resources/lib/hak5_list_episodes.py
parent7bcfc4001cd24523d25d9b9b4b884b05612afe4c (diff)
[plugin.video.hak5] 1.0.2
Diffstat (limited to 'plugin.video.hak5/resources/lib/hak5_list_episodes.py')
-rw-r--r--plugin.video.hak5/resources/lib/hak5_list_episodes.py49
1 files changed, 28 insertions, 21 deletions
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