2020-12-17 21:52:17 +01:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
# vStream https://github.com/Kodi-vStream/venom-xbmc-addons
|
|
|
|
|
|
|
|
import re
|
|
|
|
|
|
|
|
from resources.lib.gui.hoster import cHosterGui
|
|
|
|
from resources.lib.gui.gui import cGui
|
|
|
|
from resources.lib.handler.inputParameterHandler import cInputParameterHandler
|
|
|
|
from resources.lib.handler.outputParameterHandler import cOutputParameterHandler
|
|
|
|
from resources.lib.handler.requestHandler import cRequestHandler
|
|
|
|
from resources.lib.parser import cParser
|
|
|
|
from resources.lib.comaddon import progress
|
|
|
|
|
|
|
|
SITE_IDENTIFIER = 'docu_fr'
|
|
|
|
SITE_NAME = 'Docu Fr'
|
|
|
|
SITE_DESC = 'Documentaire streaming sur YT'
|
|
|
|
|
|
|
|
URL_MAIN = 'https://documentaire.io/'
|
|
|
|
|
|
|
|
DOC_NEWS = (URL_MAIN, 'showMovies')
|
|
|
|
DOC_DOCS = ('http://', 'load')
|
|
|
|
DOC_GENRES = (True, 'showGenres')
|
|
|
|
|
|
|
|
URL_SEARCH_MISC = (URL_MAIN + '?s=', 'showMovies')
|
|
|
|
FUNCTION_SEARCH = 'showMovies'
|
|
|
|
|
|
|
|
|
|
|
|
def load():
|
|
|
|
oGui = cGui()
|
|
|
|
|
|
|
|
oOutputParameterHandler = cOutputParameterHandler()
|
|
|
|
oOutputParameterHandler.addParameter('siteUrl', 'http://venom/')
|
|
|
|
oGui.addDir(SITE_IDENTIFIER, 'showSearch', 'Recherche', 'search.png', oOutputParameterHandler)
|
|
|
|
|
|
|
|
oOutputParameterHandler = cOutputParameterHandler()
|
|
|
|
oOutputParameterHandler.addParameter('siteUrl', DOC_NEWS[0])
|
|
|
|
oGui.addDir(SITE_IDENTIFIER, DOC_NEWS[1], 'Derniers ajouts', 'news.png', oOutputParameterHandler)
|
|
|
|
|
|
|
|
oOutputParameterHandler = cOutputParameterHandler()
|
|
|
|
oOutputParameterHandler.addParameter('siteUrl', DOC_GENRES[0])
|
|
|
|
oGui.addDir(SITE_IDENTIFIER, DOC_GENRES[1], 'Genres', 'genres.png', oOutputParameterHandler)
|
|
|
|
|
|
|
|
oGui.setEndOfDirectory()
|
|
|
|
|
|
|
|
|
|
|
|
def showSearch():
|
|
|
|
oGui = cGui()
|
|
|
|
|
|
|
|
sSearchText = oGui.showKeyBoard()
|
|
|
|
if (sSearchText != False):
|
|
|
|
sUrl = URL_SEARCH_MISC[0] + sSearchText.replace(' ', '+')
|
|
|
|
showMovies(sUrl)
|
|
|
|
oGui.setEndOfDirectory()
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
def showGenres():
|
|
|
|
oGui = cGui()
|
|
|
|
|
|
|
|
liste = []
|
|
|
|
liste.append(['Animaux', URL_MAIN + 'animaux/'])
|
|
|
|
liste.append(['Civilisations anciennes', URL_MAIN + 'civilisations-anciennes/'])
|
|
|
|
liste.append(['Consommation', URL_MAIN + 'consommation/'])
|
|
|
|
liste.append(['Environnement', URL_MAIN + 'environnement/'])
|
|
|
|
liste.append(['Grands conflits', URL_MAIN + 'grands-conflits/'])
|
|
|
|
liste.append(['Histoire', URL_MAIN + 'histoire/'])
|
|
|
|
liste.append(['Politique', URL_MAIN + 'politique/'])
|
|
|
|
liste.append(['Portraits', URL_MAIN + 'portraits'])
|
|
|
|
liste.append(['Santé', URL_MAIN + 'sante/'])
|
|
|
|
liste.append(['Science et technologie', URL_MAIN + 'science-et-technologie/'])
|
|
|
|
liste.append(['Société', URL_MAIN + 'societe/'])
|
|
|
|
liste.append(['Sport', URL_MAIN + 'sport/'])
|
|
|
|
liste.append(['Voyage', URL_MAIN + 'voyage/'])
|
|
|
|
|
|
|
|
for sTitle, sUrl in liste:
|
|
|
|
|
|
|
|
oOutputParameterHandler = cOutputParameterHandler()
|
|
|
|
oOutputParameterHandler.addParameter('siteUrl', sUrl)
|
|
|
|
oGui.addDir(SITE_IDENTIFIER, 'showMovies', sTitle, 'doc.png', oOutputParameterHandler)
|
|
|
|
|
|
|
|
oGui.setEndOfDirectory()
|
|
|
|
|
|
|
|
|
|
|
|
def showMovies(sSearch=''):
|
|
|
|
oGui = cGui()
|
|
|
|
oParser = cParser()
|
|
|
|
if sSearch:
|
|
|
|
sUrl = sSearch
|
|
|
|
else:
|
|
|
|
oInputParameterHandler = cInputParameterHandler()
|
|
|
|
sUrl = oInputParameterHandler.getValue('siteUrl')
|
|
|
|
|
|
|
|
oRequestHandler = cRequestHandler(sUrl)
|
|
|
|
sHtmlContent = oRequestHandler.request()
|
|
|
|
|
|
|
|
sHtmlContent = sHtmlContent.replace(' ', '').replace(''', '\'')
|
|
|
|
|
|
|
|
# if 'category' in sUrl or sSearch:
|
|
|
|
sPattern = 'article id=".+?data-background="([^"]+)">.+?<div class="read-title">.+?<a href="([^"]+)">(.+?)<\/a>'
|
|
|
|
|
|
|
|
oParser = cParser()
|
|
|
|
aResult = oParser.parse(sHtmlContent, sPattern)
|
|
|
|
|
|
|
|
if (aResult[0] == False):
|
|
|
|
oGui.addText(SITE_IDENTIFIER)
|
|
|
|
|
|
|
|
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[1]
|
|
|
|
# if 'private-video' in sUrl2:
|
|
|
|
# continue
|
|
|
|
sTitle = aEntry[2]
|
|
|
|
sThumb = aEntry[0]
|
|
|
|
|
|
|
|
oOutputParameterHandler = cOutputParameterHandler()
|
|
|
|
oOutputParameterHandler.addParameter('siteUrl', sUrl2)
|
|
|
|
oOutputParameterHandler.addParameter('sMovieTitle', sTitle)
|
|
|
|
oOutputParameterHandler.addParameter('sThumb', sThumb)
|
|
|
|
oGui.addMisc(SITE_IDENTIFIER, 'showHosters', sTitle, 'doc.png', sThumb, sTitle, 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, 'showMovies', '[COLOR teal]Page ' + number + ' >>>[/COLOR]', oOutputParameterHandler)
|
|
|
|
|
|
|
|
if not sSearch:
|
|
|
|
oGui.setEndOfDirectory()
|
|
|
|
|
|
|
|
|
|
|
|
def __checkForNextPage(sHtmlContent):
|
|
|
|
sPattern = '<a class="next page-numbers" href="([^"]+)">Next<'
|
|
|
|
oParser = cParser()
|
|
|
|
aResult = oParser.parse(sHtmlContent, sPattern)
|
|
|
|
if (aResult[0] == True):
|
|
|
|
return aResult[1][0]
|
|
|
|
|
|
|
|
return False
|
|
|
|
|
|
|
|
|
|
|
|
def showHosters(): # YT pas vu un autre hébergeur
|
|
|
|
oGui = cGui()
|
|
|
|
oInputParameterHandler = cInputParameterHandler()
|
|
|
|
sUrl = oInputParameterHandler.getValue('siteUrl')
|
|
|
|
sMovieTitle = oInputParameterHandler.getValue('sMovieTitle')
|
|
|
|
sThumb = oInputParameterHandler.getValue('sThumb')
|
|
|
|
|
|
|
|
oRequestHandler = cRequestHandler(sUrl)
|
|
|
|
sHtmlContent = oRequestHandler.request()
|
|
|
|
|
|
|
|
sPattern = '<iframe.+?src="([^"]+)"'
|
|
|
|
oParser = cParser()
|
|
|
|
aResult = oParser.parse(sHtmlContent, sPattern)
|
|
|
|
|
|
|
|
if (aResult[0] == True):
|
|
|
|
for aEntry in list(set(aResult[1])):
|
|
|
|
sHosterUrl = str(aEntry).replace('?&rel=0', '')
|
|
|
|
|
|
|
|
oHoster = cHosterGui().checkHoster(sHosterUrl)
|
|
|
|
if (oHoster != False):
|
|
|
|
oHoster.setDisplayName(sMovieTitle)
|
|
|
|
oHoster.setFileName(sMovieTitle)
|
|
|
|
cHosterGui().showHoster(oGui, oHoster, sHosterUrl, sThumb)
|
|
|
|
|
|
|
|
oGui.setEndOfDirectory()
|