Skip to content

Commit

Permalink
Skip the same urls
Browse files Browse the repository at this point in the history
  • Loading branch information
airenas committed Jul 24, 2019
1 parent 398fc5c commit 6afb95d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
2 changes: 1 addition & 1 deletion addon.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<addon id="kodi.plugin.lrt-mediateka"
version="0.1.0"
version="0.1.1"
name="LRT Mediateka (Unofficial) Plugin"
provider-name="Airenas">
<requires>
Expand Down
25 changes: 15 additions & 10 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,24 +90,29 @@ def get_videos(url):
soup = BeautifulSoup(html, "html.parser")
divs = soup.find_all('div', attrs={'class': 'media-block'})
xbmc.log('Div size ' + str(len(divs)), level=xbmc.LOGNOTICE)
arr = []
res = []
uniqRes = set()
for d in divs:
# xbmc.log('Div: ' + str(d), level=xbmc.LOGNOTICE)
if not skip(d):
pd = d.find_parent('div')
m = pd.find('h3', attrs={'class': 'news__title'})
a = m.find('a')
parentDiv = d.find_parent('div')
m = parentDiv.find('h3', attrs={'class': 'news__title'})
link = m.find('a')
ref = link.get('href')
if (not ref in uniqRes) and (not skip(d)):
r = {}
dt = extract_date(pd)

dt = extract_date(parentDiv)
if dt:
r["name"] = dt + ' ' + m.get_text()
else:
r["name"] = m.get_text()
r["url"] = a.get('href')
r["genre"] = extract_genre(pd)

r["url"] = ref
r["genre"] = extract_genre(parentDiv)
r["thumb"] = extract_image(d)
arr.append(r)
return arr
res.append(r)
uniqRes.add(ref)
return res

############################################################################

Expand Down

0 comments on commit 6afb95d

Please sign in to comment.