174 lines
6.3 KiB
Python
174 lines
6.3 KiB
Python
|
# -*- coding: utf-8 -*-
|
||
|
# vStream https://github.com/Kodi-vStream/venom-xbmc-addons
|
||
|
|
||
|
import re
|
||
|
|
||
|
from resources.lib.gui.gui import cGui
|
||
|
from resources.lib.handler.inputParameterHandler import cInputParameterHandler
|
||
|
from resources.lib.handler.outputParameterHandler import cOutputParameterHandler
|
||
|
from resources.lib.parser import cParser
|
||
|
from resources.sites.freebox import getHtml, showWeb, play__
|
||
|
from resources.lib.comaddon import progress
|
||
|
|
||
|
SITE_IDENTIFIER = 'daily_iptv_list'
|
||
|
SITE_NAME = 'Daily Iptv List'
|
||
|
SITE_DESC = 'Regarder la télévision'
|
||
|
|
||
|
URL_MAIN = 'https://www.dailyiptvlist.com/'
|
||
|
URL_EUROPE = URL_MAIN + 'europe-m3u-iptv/'
|
||
|
URL_AMERICA = URL_MAIN + 'iptv-american/'
|
||
|
URL_ASIA = URL_MAIN + 'asia/'
|
||
|
URL_SPORT = URL_MAIN + 'sport-iptv-m3u/'
|
||
|
URL_WORLDWIDE = URL_MAIN + 'iptv-world-wide/'
|
||
|
|
||
|
|
||
|
def load():
|
||
|
oGui = cGui()
|
||
|
|
||
|
oOutputParameterHandler = cOutputParameterHandler()
|
||
|
oOutputParameterHandler.addParameter('siteUrl', URL_MAIN)
|
||
|
oGui.addDir(SITE_IDENTIFIER, 'showDailyList', 'Derniere liste', 'tv.png', oOutputParameterHandler)
|
||
|
|
||
|
oOutputParameterHandler = cOutputParameterHandler()
|
||
|
oOutputParameterHandler.addParameter('siteUrl', URL_MAIN)
|
||
|
oGui.addDir(SITE_IDENTIFIER, 'showPays', 'Choix du pays', 'tv.png', oOutputParameterHandler)
|
||
|
|
||
|
oOutputParameterHandler = cOutputParameterHandler()
|
||
|
oOutputParameterHandler.addParameter('siteUrl', URL_EUROPE)
|
||
|
oGui.addDir(SITE_IDENTIFIER, 'showDailyList', 'Liste iptv Europe', 'tv.png', oOutputParameterHandler)
|
||
|
|
||
|
oOutputParameterHandler = cOutputParameterHandler()
|
||
|
oOutputParameterHandler.addParameter('siteUrl', URL_AMERICA)
|
||
|
oGui.addDir(SITE_IDENTIFIER, 'showDailyList', 'Liste iptv America', 'tv.png', oOutputParameterHandler)
|
||
|
|
||
|
oOutputParameterHandler = cOutputParameterHandler()
|
||
|
oOutputParameterHandler.addParameter('siteUrl', URL_ASIA)
|
||
|
oGui.addDir(SITE_IDENTIFIER, 'showDailyList', 'Liste iptv Asia', 'tv.png', oOutputParameterHandler)
|
||
|
|
||
|
oOutputParameterHandler = cOutputParameterHandler()
|
||
|
oOutputParameterHandler.addParameter('siteUrl', URL_SPORT)
|
||
|
oGui.addDir(SITE_IDENTIFIER, 'showDailyList', 'Liste iptv Sport', 'tv.png', oOutputParameterHandler)
|
||
|
|
||
|
oOutputParameterHandler = cOutputParameterHandler()
|
||
|
oOutputParameterHandler.addParameter('siteUrl', URL_WORLDWIDE)
|
||
|
oGui.addDir(SITE_IDENTIFIER, 'showDailyList', 'Liste iptv Worldwide', 'tv.png', oOutputParameterHandler)
|
||
|
|
||
|
oGui.setEndOfDirectory()
|
||
|
|
||
|
|
||
|
def showPays():
|
||
|
oGui = cGui()
|
||
|
oInputParameterHandler = cInputParameterHandler()
|
||
|
sUrl = oInputParameterHandler.getValue('siteUrl')
|
||
|
|
||
|
oParser = cParser()
|
||
|
sHtmlContent = getHtml(sUrl)
|
||
|
sPattern = '<li class="cat-item cat-item-.+?"><a href="([^"]+)".+?>([^<]+)</a>'
|
||
|
aResult = oParser.parse(sHtmlContent, sPattern)
|
||
|
|
||
|
if (aResult[0] == True):
|
||
|
total = len(aResult[1])
|
||
|
progress_ = progress().VScreate(SITE_NAME)
|
||
|
|
||
|
for aEntry in aResult[1]:
|
||
|
progress_.VSupdate(progress_, total)
|
||
|
if progress_.iscanceled():
|
||
|
break
|
||
|
|
||
|
sUrl2 = aEntry[0]
|
||
|
sTitle = aEntry[1]
|
||
|
|
||
|
oOutputParameterHandler = cOutputParameterHandler()
|
||
|
oOutputParameterHandler.addParameter('siteUrl', sUrl2)
|
||
|
oOutputParameterHandler.addParameter('sMovieTitle', sTitle)
|
||
|
|
||
|
oGui.addDir(SITE_IDENTIFIER, 'showDailyList', sTitle, 'tv.png', oOutputParameterHandler)
|
||
|
|
||
|
progress_.VSclose(progress_)
|
||
|
|
||
|
oGui.setEndOfDirectory()
|
||
|
|
||
|
|
||
|
def showDailyList():
|
||
|
oGui = cGui()
|
||
|
oInputParameterHandler = cInputParameterHandler()
|
||
|
sUrl = oInputParameterHandler.getValue('siteUrl')
|
||
|
|
||
|
oParser = cParser()
|
||
|
sHtmlContent = getHtml(sUrl)
|
||
|
sPattern = '</a><h2 class="post-title"><a href="([^"]+)">([^<]+)</a></h2><div class="excerpt"><p>.+?</p>'
|
||
|
aResult = oParser.parse(sHtmlContent, sPattern)
|
||
|
|
||
|
if (aResult[0] == True):
|
||
|
total = len(aResult[1])
|
||
|
progress_ = progress().VScreate(SITE_NAME)
|
||
|
|
||
|
for aEntry in aResult[1]:
|
||
|
progress_.VSupdate(progress_, total)
|
||
|
if progress_.iscanceled():
|
||
|
break
|
||
|
|
||
|
sUrl2 = aEntry[0]
|
||
|
sTitle = aEntry[1]
|
||
|
|
||
|
oOutputParameterHandler = cOutputParameterHandler()
|
||
|
oOutputParameterHandler.addParameter('siteUrl', sUrl2)
|
||
|
oOutputParameterHandler.addParameter('sMovieTitle', sTitle)
|
||
|
|
||
|
oGui.addDir(SITE_IDENTIFIER, 'showAllPlaylist', sTitle, 'tv.png', oOutputParameterHandler)
|
||
|
|
||
|
progress_.VSclose(progress_)
|
||
|
|
||
|
sNextPage = __checkForNextPage(sHtmlContent)
|
||
|
if (sNextPage != False):
|
||
|
oOutputParameterHandler = cOutputParameterHandler()
|
||
|
oOutputParameterHandler.addParameter('siteUrl', sNextPage)
|
||
|
number = re.search('/page/([0-9]+)', sNextPage).group(1)
|
||
|
oGui.addNext(SITE_IDENTIFIER, 'showDailyList', '[COLOR teal]Page ' + number + ' >>>[/COLOR]', oOutputParameterHandler)
|
||
|
|
||
|
oGui.setEndOfDirectory()
|
||
|
|
||
|
|
||
|
def __checkForNextPage(sHtmlContent):
|
||
|
oParser = cParser()
|
||
|
sPattern = '<a class="next page-numbers" href="([^"]+)">'
|
||
|
aResult = oParser.parse(sHtmlContent, sPattern)
|
||
|
|
||
|
if (aResult[0] == True):
|
||
|
return aResult[1][0]
|
||
|
|
||
|
return False
|
||
|
|
||
|
|
||
|
def showAllPlaylist():
|
||
|
oGui = cGui()
|
||
|
oInputParameterHandler = cInputParameterHandler()
|
||
|
sUrl = oInputParameterHandler.getValue('siteUrl')
|
||
|
|
||
|
oParser = cParser()
|
||
|
sHtmlContent = getHtml(sUrl)
|
||
|
sPattern = '<p></br><br /><strong>2. Click on link to download .+? iptv channels list</strong></p>|<a href="([^"]+)">Download ([^<]+)</a>'
|
||
|
aResult = oParser.parse(sHtmlContent, sPattern)
|
||
|
|
||
|
if (aResult[0] == True):
|
||
|
total = len(aResult[1])
|
||
|
progress_ = progress().VScreate(SITE_NAME)
|
||
|
|
||
|
for aEntry in aResult[1]:
|
||
|
progress_.VSupdate(progress_, total)
|
||
|
if progress_.iscanceled():
|
||
|
break
|
||
|
|
||
|
sUrl2 = aEntry[0]
|
||
|
sTitle = aEntry[1]
|
||
|
|
||
|
oOutputParameterHandler = cOutputParameterHandler()
|
||
|
oOutputParameterHandler.addParameter('siteUrl', sUrl2)
|
||
|
oOutputParameterHandler.addParameter('sMovieTitle', sTitle)
|
||
|
|
||
|
oGui.addDir(SITE_IDENTIFIER, 'showWeb', sTitle, '', oOutputParameterHandler)
|
||
|
|
||
|
progress_.VSclose(progress_)
|
||
|
|
||
|
oGui.setEndOfDirectory()
|