Skip to content

Commit

Permalink
Adapted to new version of BeautifulSoap4 4.9.3, fixes #19.
Browse files Browse the repository at this point in the history
+ Fixed thumbnail and fanart images acquisition.
  • Loading branch information
kapitan-iglu committed Apr 18, 2021
1 parent be843c9 commit aed2a5f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 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.15"
version="0.0.16"
provider-name="koudi">
<requires>
<import addon="xbmc.python" version="2.1.0" />
Expand Down
3 changes: 3 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
2021-04-18 [0.0.16]
* Adapted to new version of BeautifulSoap4 4.9.3
* Fixed thumbnail and fanart images acquisition
2020-11-09 [0.0.15]
* Added sub-categories for live streams
2020-10-29 [0.0.14]
Expand Down
17 changes: 7 additions & 10 deletions mall.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,12 @@ def __init__(self, plugin):
self.is_cz = self.plugin.get_setting('country') == '0'
self.BASE = 'https://www.mall.tv' if self.is_cz else 'https://sk.mall.tv'

def unify_url(self, url):
return re.sub(r"//[^\.]+\.", "//zeus.", url)

def get_img_for(self, img_version, url):
if '/mobile/' in url:
url=url.replace('/mobile/','/'+img_version+'/')
else:
url=url.replace('/mobile-a/','/'+img_version+'/')
return self.unify_url(url)
for pattern in ['/mobile/', '/mobile-a/', '/desktop/']:
if pattern in url:
url=url.replace(pattern,'/'+img_version+'/')
break
return url

def get_fanart_url(self, url):
return self.get_img_for('background', url)
Expand Down Expand Up @@ -278,9 +275,9 @@ def get_duration(self, val):

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)
script_tag = page.find(lambda tag: tag.name == 'script' and (tag.string and 'VideoSource' in tag.string))
# 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'))
tmp_str = re.sub(r'^.*VideoSource"[\s]*:[\s]*"', '', script_tag.string)
# removes everything after the value including the quote character
return re.sub(r'["\s]*,["\s]*.*$', '', tmp_str).strip()

Expand Down

0 comments on commit aed2a5f

Please sign in to comment.