forked from STI/Astroport.ONE
377 lines
14 KiB
Python
377 lines
14 KiB
Python
# -*- 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 siteManager
|
|
from resources.lib.util import cUtil
|
|
|
|
UA = 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:70.0) Gecko/20100101 Firefox/70.0'
|
|
|
|
SITE_IDENTIFIER = '_1seriestreaming'
|
|
SITE_NAME = '1 Serie Streaming'
|
|
SITE_DESC = 'Séries & Animés en Streaming'
|
|
|
|
URL_MAIN = siteManager().getUrlMain(SITE_IDENTIFIER)
|
|
|
|
SERIE_SERIES = ('http://', 'load')
|
|
SERIE_NEWS = (URL_MAIN + 'series-streaming', 'showSeries')
|
|
SERIE_VIEWS = (URL_MAIN + 'series-populaires', 'showSeries')
|
|
SERIE_LIST = (URL_MAIN, 'showAlpha')
|
|
SERIE_GENRES = (True, 'showGenres')
|
|
SERIE_ANNEES = (True, 'showSerieYears')
|
|
|
|
URL_SEARCH = ('', 'showSeries')
|
|
URL_SEARCH_SERIES = (URL_SEARCH[0], 'showSeries')
|
|
FUNCTION_SEARCH = 'showSeries'
|
|
|
|
|
|
def load():
|
|
oGui = cGui()
|
|
|
|
oOutputParameterHandler = cOutputParameterHandler()
|
|
oOutputParameterHandler.addParameter('siteUrl', 'http://venom/')
|
|
oGui.addDir(SITE_IDENTIFIER, 'showSearch', 'Recherche', 'search.png', oOutputParameterHandler)
|
|
|
|
oOutputParameterHandler.addParameter('siteUrl', SERIE_NEWS[0])
|
|
oGui.addDir(SITE_IDENTIFIER, SERIE_NEWS[1], 'Séries (Derniers ajouts)', 'news.png', oOutputParameterHandler)
|
|
|
|
oOutputParameterHandler.addParameter('siteUrl', SERIE_VIEWS[0])
|
|
oGui.addDir(SITE_IDENTIFIER, SERIE_VIEWS[1], 'Séries (Populaires)', 'comments.png', oOutputParameterHandler)
|
|
|
|
oOutputParameterHandler.addParameter('siteUrl', SERIE_LIST[0])
|
|
oGui.addDir(SITE_IDENTIFIER, SERIE_LIST[1], 'Séries (Liste)', 'listes.png', oOutputParameterHandler)
|
|
|
|
oOutputParameterHandler.addParameter('siteUrl', SERIE_GENRES[0])
|
|
oGui.addDir(SITE_IDENTIFIER, SERIE_GENRES[1], 'Séries (Genres)', 'genres.png', oOutputParameterHandler)
|
|
|
|
oOutputParameterHandler.addParameter('siteUrl', SERIE_ANNEES[0])
|
|
oGui.addDir(SITE_IDENTIFIER, SERIE_ANNEES[1], 'Séries (Par années)', 'annees.png', oOutputParameterHandler)
|
|
|
|
oGui.setEndOfDirectory()
|
|
|
|
|
|
def showSearch():
|
|
oGui = cGui()
|
|
sSearchText = oGui.showKeyBoard()
|
|
if sSearchText is not False:
|
|
sUrl = URL_SEARCH[0] + sSearchText
|
|
showSeries(sUrl)
|
|
oGui.setEndOfDirectory()
|
|
return
|
|
|
|
|
|
def showSerieYears():
|
|
# for i in itertools.chain(range(5, 7), [8, 9]): afficher dans l'ordre (pense bete ne pas effacer)
|
|
oGui = cGui()
|
|
from itertools import chain
|
|
generator = chain([1955], range(1957, 2022))
|
|
|
|
oOutputParameterHandler = cOutputParameterHandler()
|
|
for i in reversed(list(generator)):
|
|
Year = str(i)
|
|
oOutputParameterHandler.addParameter('siteUrl', URL_MAIN + 'annee/' + Year)
|
|
oGui.addDir(SITE_IDENTIFIER, 'showSeries', Year, 'annees.png', oOutputParameterHandler)
|
|
|
|
oGui.setEndOfDirectory()
|
|
|
|
|
|
def showAlpha():
|
|
oGui = cGui()
|
|
|
|
liste = [['0', str('0')], ['1', str('1')], ['2', str('2')], ['3', str('3')], ['4', str('4')], ['5', str('5')],
|
|
['6', str('6')], ['7', str('7')], ['8', str('8')], ['9', str('9')],
|
|
['A', 'A'], ['B', 'B'], ['C', 'C'], ['D', 'D'], ['E', 'E'], ['F', 'F'], ['G', 'G'], ['H', 'H'],
|
|
['I', 'I'], ['J', 'J'], ['K', 'K'], ['L', 'L'], ['M', 'M'], ['N', 'N'], ['O', 'O'], ['P', 'P'],
|
|
['Q', 'Q'], ['R', 'R'], ['S', 'S'], ['T', 'T'], ['U', 'U'], ['V', 'V'], ['W', 'W'], ['X', 'X'],
|
|
['Y', 'Y'], ['Z', 'Z']]
|
|
|
|
oOutputParameterHandler = cOutputParameterHandler()
|
|
for sTitle, sUrl in liste:
|
|
oOutputParameterHandler.addParameter('siteUrl', URL_MAIN + 'alphabet/' + sUrl)
|
|
oGui.addDir(SITE_IDENTIFIER, 'showSeries', 'Lettre [COLOR coral]' + sTitle + '[/COLOR]', 'az.png', oOutputParameterHandler)
|
|
|
|
oGui.setEndOfDirectory()
|
|
|
|
|
|
def showGenres():
|
|
oGui = cGui()
|
|
|
|
liste = [['Action & Aventure', 'action-adventure'], ['Animation', 'animation'], ['Comédie', 'comedie'],
|
|
['Crime', 'crime'], ['Documentaire', 'documentaire'], ['Drame', 'drame'], ['Familial', 'familial'],
|
|
['Guerre', 'guerre'], ['Guerre & Politique', 'war-politics'], ['Histoire', 'histoire'], ['Kids', 'kids'],
|
|
['Musical', 'musical'], ['Musique', 'musique'], ['Mystère', 'mystere'], ['News', 'news'],
|
|
['Réalité', 'reality'], ['Romance', 'romance'], ['Science-fiction', 'science-fiction'],
|
|
['Science-Fiction Fantastique', 'science-fiction-fantastique'], ['Soap', 'soap'], ['Sport', 'sport'],
|
|
['Talk', 'talk'], ['Thriller', 'thriller'], ['Western', 'western']]
|
|
|
|
oOutputParameterHandler = cOutputParameterHandler()
|
|
for sTitle, sUrl in liste:
|
|
oOutputParameterHandler.addParameter('siteUrl', URL_MAIN + 'categories/' + sUrl + '/series')
|
|
oGui.addDir(SITE_IDENTIFIER, 'showSeries', sTitle, 'genres.png', oOutputParameterHandler)
|
|
|
|
oGui.setEndOfDirectory()
|
|
|
|
|
|
def showSeries(sSearch=''):
|
|
oGui = cGui()
|
|
oParser = cParser()
|
|
|
|
if sSearch:
|
|
oUtil = cUtil()
|
|
sSearchText = oUtil.CleanName(sSearch)
|
|
sSearch = sSearch.replace(' ', '+').replace('&20', '+')
|
|
bValid, sToken, sCookie = getTokens()
|
|
if bValid:
|
|
sUrl = URL_MAIN + 'search'
|
|
pdata = '_token=' + sToken + '&search=' + sSearch
|
|
|
|
oRequestHandler = cRequestHandler(sUrl)
|
|
oRequestHandler.setRequestType(1)
|
|
oRequestHandler.addHeaderEntry('User-Agent', UA)
|
|
oRequestHandler.addHeaderEntry('Content-Type', 'application/x-www-form-urlencoded')
|
|
oRequestHandler.addHeaderEntry('Referer', URL_MAIN)
|
|
oRequestHandler.addHeaderEntry('Cookie', sCookie)
|
|
oRequestHandler.addParametersLine(pdata)
|
|
sHtmlContent = oRequestHandler.request()
|
|
else:
|
|
oGui.addText(SITE_IDENTIFIER)
|
|
return
|
|
else:
|
|
oInputParameterHandler = cInputParameterHandler()
|
|
sUrl = oInputParameterHandler.getValue('siteUrl')
|
|
oRequestHandler = cRequestHandler(sUrl)
|
|
sHtmlContent = oRequestHandler.request()
|
|
|
|
sPattern = 'link"><img src=([^ ]+).+?href="([^"]+).+?>([^<]+)'
|
|
aResult = oParser.parse(sHtmlContent, sPattern)
|
|
if aResult[0] is False:
|
|
oGui.addText(SITE_IDENTIFIER)
|
|
|
|
if aResult[0] is True:
|
|
oOutputParameterHandler = cOutputParameterHandler()
|
|
for aEntry in aResult[1]:
|
|
sThumb = re.sub('/w\d+/', '/w342/', aEntry[0])
|
|
sUrl2 = aEntry[1]
|
|
if sUrl2.startswith('/'):
|
|
sUrl2 = URL_MAIN[:-1] + sUrl2
|
|
sTitle = aEntry[2]
|
|
if sSearch:
|
|
if not oUtil.CheckOccurence(sSearchText, sTitle):
|
|
continue # Filtre de recherche
|
|
|
|
oOutputParameterHandler.addParameter('siteUrl', sUrl2)
|
|
oOutputParameterHandler.addParameter('sMovieTitle', sTitle)
|
|
oOutputParameterHandler.addParameter('sThumb', sThumb)
|
|
oGui.addTV(SITE_IDENTIFIER, 'showSaisons', sTitle, '', sThumb, '', oOutputParameterHandler)
|
|
|
|
sNextPage, sPaging = __checkForNextPage(sHtmlContent)
|
|
if sNextPage is not False:
|
|
oOutputParameterHandler = cOutputParameterHandler()
|
|
oOutputParameterHandler.addParameter('siteUrl', sNextPage)
|
|
oGui.addNext(SITE_IDENTIFIER, 'showSeries', 'Page ' + sPaging, oOutputParameterHandler)
|
|
|
|
if not sSearch:
|
|
oGui.setEndOfDirectory()
|
|
|
|
|
|
def __checkForNextPage(sHtmlContent):
|
|
oParser = cParser()
|
|
sPattern = '> \d+ </span><a href="([^"]+).+?>([^<]+)</a></div></div>'
|
|
aResult = oParser.parse(sHtmlContent, sPattern)
|
|
if aResult[0] is True:
|
|
sNextPage = aResult[1][0][0]
|
|
sNumberMax = aResult[1][0][1]
|
|
sNumberNext = re.search('page=([0-9]+)', sNextPage).group(1)
|
|
sPaging = sNumberNext + '/' + sNumberMax
|
|
return sNextPage, sPaging
|
|
|
|
return False, 'none'
|
|
|
|
|
|
def showSaisons():
|
|
oGui = cGui()
|
|
oParser = cParser()
|
|
oInputParameterHandler = cInputParameterHandler()
|
|
sUrl = oInputParameterHandler.getValue('siteUrl')
|
|
sThumb = oInputParameterHandler.getValue('sThumb')
|
|
|
|
oRequestHandler = cRequestHandler(sUrl)
|
|
sHtmlContent = oRequestHandler.request()
|
|
|
|
# récupération du Synopsis
|
|
sDesc = ''
|
|
try:
|
|
sPattern = 'fsynopsis"><p>([^<]+)<br>'
|
|
aResult = oParser.parse(sHtmlContent, sPattern)
|
|
if aResult[0]:
|
|
sDesc = aResult[1][0]
|
|
except:
|
|
pass
|
|
|
|
sPattern = 'link"><img src=([^ ]+).+?href="([^"]+).+?>([^<]+)'
|
|
aResult = oParser.parse(sHtmlContent, sPattern)
|
|
|
|
if aResult[0] is True:
|
|
oOutputParameterHandler = cOutputParameterHandler()
|
|
for aEntry in aResult[1]:
|
|
|
|
if 'no-poster.svg' not in aEntry[0]:
|
|
sThumb = aEntry[0]
|
|
else:
|
|
sThumb = sThumb
|
|
sUrl = aEntry[1]
|
|
sTitle = aEntry[2]
|
|
|
|
oOutputParameterHandler.addParameter('siteUrl', sUrl)
|
|
oOutputParameterHandler.addParameter('sMovieTitle', sTitle)
|
|
oOutputParameterHandler.addParameter('sThumb', sThumb)
|
|
oOutputParameterHandler.addParameter('sDesc', sDesc)
|
|
oGui.addSeason(SITE_IDENTIFIER, 'showEpisodes', sTitle, '', sThumb, sDesc, oOutputParameterHandler)
|
|
|
|
oGui.setEndOfDirectory()
|
|
|
|
|
|
def showEpisodes():
|
|
oGui = cGui()
|
|
oParser = cParser()
|
|
oInputParameterHandler = cInputParameterHandler()
|
|
sUrl = oInputParameterHandler.getValue('siteUrl')
|
|
sMovieTitle = oInputParameterHandler.getValue('sMovieTitle')
|
|
sThumb = oInputParameterHandler.getValue('sThumb')
|
|
sDesc = oInputParameterHandler.getValue('sDesc')
|
|
|
|
oRequestHandler = cRequestHandler(sUrl)
|
|
sHtmlContent = oRequestHandler.request()
|
|
|
|
sPattern = 'LI2"><a href="([^"]+)"><span>([^<]+)'
|
|
aResult = oParser.parse(sHtmlContent, sPattern)
|
|
|
|
if aResult[0] is True:
|
|
oOutputParameterHandler = cOutputParameterHandler()
|
|
for aEntry in aResult[1]:
|
|
|
|
sUrl = aEntry[0]
|
|
sTitle = sMovieTitle + aEntry[1]
|
|
|
|
oOutputParameterHandler.addParameter('siteUrl', sUrl)
|
|
oOutputParameterHandler.addParameter('sMovieTitle', sTitle)
|
|
oOutputParameterHandler.addParameter('sThumb', sThumb)
|
|
oOutputParameterHandler.addParameter('sDesc', sDesc)
|
|
oGui.addEpisode(SITE_IDENTIFIER, 'showLinks', sTitle, '', sThumb, sDesc, oOutputParameterHandler)
|
|
|
|
oGui.setEndOfDirectory()
|
|
|
|
|
|
def showLinks():
|
|
oGui = cGui()
|
|
oParser = cParser()
|
|
oInputParameterHandler = cInputParameterHandler()
|
|
sUrl = oInputParameterHandler.getValue('siteUrl')
|
|
sMovieTitle = oInputParameterHandler.getValue('sMovieTitle')
|
|
sThumb = oInputParameterHandler.getValue('sThumb')
|
|
sDesc = oInputParameterHandler.getValue('sDesc')
|
|
|
|
oRequestHandler = cRequestHandler(sUrl)
|
|
sHtmlContent = oRequestHandler.request()
|
|
|
|
sPattern = 'code="([^"]+).+?</i>([^<]+).+?flag/([^ ]+).png'
|
|
aResult = oParser.parse(sHtmlContent, sPattern)
|
|
|
|
if aResult[0] is True:
|
|
oOutputParameterHandler = cOutputParameterHandler()
|
|
for aEntry in aResult[1]:
|
|
|
|
sHost = aEntry[1].replace('www.', '')
|
|
sHost = re.sub('\..+', '', sHost).capitalize()
|
|
if (cHosterGui().checkHoster(sHost) == False):
|
|
continue
|
|
|
|
sLang = aEntry[2].replace('default', '').upper()
|
|
sUrl = URL_MAIN + 'll/captcha?hash=' + aEntry[0]
|
|
sTitle = ('%s (%s) [COLOR coral]%s[/COLOR]') % (sMovieTitle, sLang, sHost)
|
|
|
|
oOutputParameterHandler.addParameter('siteUrl', sUrl)
|
|
oOutputParameterHandler.addParameter('sMovieTitle', sMovieTitle)
|
|
oOutputParameterHandler.addParameter('sThumb', sThumb)
|
|
oOutputParameterHandler.addParameter('sHost', sHost)
|
|
oOutputParameterHandler.addParameter('sLang', sLang)
|
|
oOutputParameterHandler.addParameter('sDesc', sDesc)
|
|
oGui.addLink(SITE_IDENTIFIER, 'showHosters', sTitle, sThumb, sDesc, oOutputParameterHandler)
|
|
|
|
oGui.setEndOfDirectory()
|
|
|
|
|
|
def showHosters():
|
|
oGui = cGui()
|
|
oInputParameterHandler = cInputParameterHandler()
|
|
sUrl = oInputParameterHandler.getValue('siteUrl')
|
|
sMovieTitle = oInputParameterHandler.getValue('sMovieTitle')
|
|
sThumb = oInputParameterHandler.getValue('sThumb')
|
|
|
|
oRequest = cRequestHandler(sUrl)
|
|
oRequest.addHeaderEntry('User-Agent', UA)
|
|
oRequest.addHeaderEntry('Referer', sUrl)
|
|
|
|
sHtmlContent = oRequest.request()
|
|
sHosterUrl = oRequest.getRealUrl()
|
|
|
|
if 'captcha' not in sHosterUrl:
|
|
oHoster = cHosterGui().checkHoster(sHosterUrl)
|
|
if oHoster is not False:
|
|
oHoster.setDisplayName(sMovieTitle)
|
|
oHoster.setFileName(sMovieTitle)
|
|
cHosterGui().showHoster(oGui, oHoster, sHosterUrl, sThumb)
|
|
else:
|
|
oParser = cParser()
|
|
sPattern = 'src=([^ ]+)'
|
|
aResult = oParser.parse(sHtmlContent, sPattern)
|
|
if aResult[0] is True:
|
|
sHosterUrl = aResult[1][0]
|
|
oHoster = cHosterGui().checkHoster(sHosterUrl)
|
|
if oHoster is not False:
|
|
oHoster.setDisplayName(sMovieTitle)
|
|
oHoster.setFileName(sMovieTitle)
|
|
cHosterGui().showHoster(oGui, oHoster, sHosterUrl, sThumb)
|
|
|
|
oGui.setEndOfDirectory()
|
|
|
|
|
|
def getTokens():
|
|
oParser = cParser()
|
|
oRequestHandler = cRequestHandler(URL_MAIN + 'accueil')
|
|
sHtmlContent = oRequestHandler.request()
|
|
|
|
token = ''
|
|
XSRF_TOKEN = ''
|
|
site_session = ''
|
|
|
|
sHeader = oRequestHandler.getResponseHeader()
|
|
sPattern = 'name=_token value="([^"]+)'
|
|
aResult = oParser.parse(sHtmlContent, sPattern)
|
|
|
|
if aResult[0] is False:
|
|
return False, 'none', 'none'
|
|
|
|
if aResult[0] is True:
|
|
token = aResult[1][0]
|
|
|
|
sPattern = 'XSRF-TOKEN=([^;]+).+?.+?1seriestreaming_session=([^;]+)'
|
|
aResult = oParser.parse(sHeader, sPattern)
|
|
|
|
if aResult[0] is False:
|
|
return False, 'none', 'none'
|
|
|
|
if aResult[0] is True:
|
|
XSRF_TOKEN = aResult[1][0][0]
|
|
site_session = aResult[1][0][1]
|
|
|
|
cook = 'XSRF-TOKEN=' + XSRF_TOKEN + '; 1seriestreaming_session=' + site_session + ';'
|
|
return True, token, cook
|