Skip to content

Commit

Permalink
Merge pull request #15 from kamilnezval/live-video-fix
Browse files Browse the repository at this point in the history
plugin.video.mall.tv: version 0.0.14
Video url extracted from internal json structure instead of using meta data tag, which is no longer working for live videos.
  • Loading branch information
kapitan-iglu authored Oct 29, 2020
2 parents 1951471 + e44c539 commit e649f5e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion addon.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.mall.tv"
name="Mall.TV"
version="0.0.13"
version="0.0.14"
provider-name="koudi">
<requires>
<import addon="xbmc.python" version="2.1.0" />
Expand Down
2 changes: 2 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
2020-10-29 [0.0.14]
* Fixed live video stream playback
2020-10-14 [0.0.13]
* Fixed access to categories recent, popular and exact show from kodi favourite list
2020-09-10 [0.0.12]
Expand Down
14 changes: 12 additions & 2 deletions mall.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,15 +254,25 @@ def get_duration(self, val):

return count

def get_video_main_url(self, page):
# extracts a video url from a script tag, it's in an internal json structure under VideoSource value
script_tag = page.find(lambda tag: tag.name == 'script' and 'VideoSource' in tag.text)
# removes everything before the value of VideoSource including the quote character
tmp_str = re.sub(r'^.*VideoSource"[\s]*:[\s]*"', '', script_tag.string.encode('utf-8'))
# removes everything after the value including the quote character
return re.sub(r'["\s]*,["\s]*.*$', '', tmp_str).strip()

def get_video_url(self, link, is_live=False):
page = self.get_page(link)

source = page.find('source')

if not source:
main_link = page.find('meta', {'itemprop': 'image'})['content'].replace('retina.jpg', 'index.m3u8')
main_link = self.get_video_main_url(page)
else:
main_link = source['src'] + '.m3u8'
main_link = source['src']

main_link += '.m3u8'
url_parts = urlparse(main_link, 'https')
main_link = urlunparse(url_parts)

Expand Down

0 comments on commit e649f5e

Please sign in to comment.