Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 5.16 KB | None | 0 0
  1. #-*- coding: utf-8 -*-
  2. # https://github.com/Kodi-vStream/venom-xbmc-addons
  3. from resources.lib.handler.requestHandler import cRequestHandler
  4. from resources.lib.parser import cParser
  5. from resources.hosters.hoster import iHoster
  6.  
  7. from resources.lib.jsparser import JsParser
  8. from resources.lib.packer import cPacker
  9. import re
  10.  
  11. from resources.lib.comaddon import VSlog
  12.  
  13. UA = 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.'
  14.  
  15. class cHoster(iHoster):
  16.  
  17.     def __init__(self):
  18.         self.__sDisplayName = 'MyStream'
  19.         self.__sFileName = self.__sDisplayName
  20.  
  21.     def getDisplayName(self):
  22.         return  self.__sDisplayName
  23.  
  24.     def setDisplayName(self, sDisplayName):
  25.         self.__sDisplayName = sDisplayName + ' [COLOR skyblue]' + self.__sDisplayName + '[/COLOR]'
  26.  
  27.     def setFileName(self, sFileName):
  28.         self.__sFileName = sFileName
  29.  
  30.     def getFileName(self):
  31.         return self.__sFileName
  32.  
  33.     def getPluginIdentifier(self):
  34.         return 'mystream'
  35.  
  36.     def isDownloadable(self):
  37.         return True
  38.  
  39.     def setUrl(self, sUrl):
  40.         self.__sUrl = str(sUrl)
  41.  
  42.         # sPattern =  '(?:https*:\/\/|\/\/)(?:www.|embed.|)mystream.(?:la|com|to)\/(?:video\/|external\/|embed-|)([0-9a-zA-Z]+)'
  43.         # oParser = cParser()
  44.         # aResult = oParser.parse(sUrl, sPattern)
  45.         # self.__sUrl = 'https://mysembed.net/' + str(aResult[1][0])
  46.  
  47.     def checkUrl(self, sUrl):
  48.         return True
  49.  
  50.     def getUrl(self):
  51.         return self.__sUrl
  52.  
  53.     def getMediaLink(self):
  54.         return self.__getMediaLinkForGuest()
  55.  
  56.     def __getMediaLinkForGuest(self):
  57.        
  58.         #VSlog(self.__sUrl)
  59.         url = self.__sUrl
  60.        
  61.         #url = self.__sUrl.replace('embed.mystream.to','mstream.cloud')
  62.         #url = 'https://mstream.cloud/gfa35ebu1nt1'
  63.  
  64.         oRequest = cRequestHandler(url)
  65.         oRequest.addHeaderEntry('User-Agent', UA)
  66.         oRequest.addHeaderEntry('Accept', 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8')
  67.         #oRequest.addHeaderEntry('Accept-Encoding', 'identity')
  68.         oRequest.addHeaderEntry('Referer', 'https://www.voirfilms.ec/voirfilms')
  69.         sHtmlContent = oRequest.request()
  70.        
  71.         #fh = open('c:\\test.txt', "w")
  72.         #fh.write(sHtmlContent)
  73.         #fh.close()
  74.  
  75.        
  76.         #decodage de la page html
  77.         sHtmlContent3 = sHtmlContent
  78.         maxboucle = 10
  79.         while (maxboucle > 0):
  80.             VSlog('loop : ' + str(maxboucle))
  81.             sHtmlContent3 = CheckCpacker(sHtmlContent3)
  82.             #sHtmlContent3 = CheckJJDecoder(sHtmlContent3)
  83.             sHtmlContent3 = CheckAADecoder(sHtmlContent3)
  84.  
  85.             maxboucle = maxboucle - 1
  86.  
  87.         sHtmlContent = sHtmlContent3
  88.  
  89.         fh = open('c:\\test.txt', "w")
  90.         fh.write(sHtmlContent)
  91.         fh.close()
  92.        
  93.         oParser = cParser()
  94.        
  95.         api_call = False
  96.         sPattern =  '<meta name="og:image" content="(.+?.jpg)">'
  97.  
  98.         aResult = oParser.parse(sHtmlContent, sPattern)
  99.         if (aResult[0] == True):
  100.             api_call = aResult[1][0].replace('img/','').replace('jpg','mp4')
  101.  
  102.            
  103.         # sPattern =  '(?:[>;]\s*)(゚ω゚.+?\(\'_\'\);)'
  104.         # aResult = oParser.parse(sHtmlContent, sPattern)
  105.         # if aResult[0]:
  106.             # for i in aResult[1]:
  107.                 # decoded = AADecoder(i).decode()
  108.                
  109.                 # #VSlog(decoded)
  110.                
  111.                 # r = re.search("\('src', '([^']+)'\);", decoded, re.DOTALL | re.UNICODE)
  112.                 # if r:
  113.                     # api_call = r.group(1)
  114.                     # break
  115.        
  116.         # #VSlog(api_call)
  117.        
  118.         # if 'qziqcysljv' in api_call:
  119.             # api_call = ''
  120.  
  121.         if (api_call):
  122.             return True, api_call
  123.  
  124.         return False, False
  125.  
  126.        
  127. #********************************************************************************************************************************
  128.  
  129. def CheckCpacker(str):
  130.  
  131.     sPattern = '(function\(p,a,c,k,e(?:.|\s)+?{}\)\)\s*)'
  132.     aResult = re.search(sPattern, str, re.DOTALL | re.UNICODE)
  133.     if (aResult):
  134.         #VSlog('Cpacker encryption')
  135.         str2 = aResult.group(1)
  136.  
  137.         if not str2.endswith(';'):
  138.             str2 = str2 + ';'
  139.            
  140.         #VSlog(str2)
  141.  
  142.         try:
  143.             tmp = cPacker().unpack(str2)
  144.         except:
  145.             tmp = ''
  146.  
  147.         #VSlog(tmp)
  148.  
  149.         return str[:(aResult.start() + 0)] + tmp + str[(aResult.end()-1):]
  150.  
  151.     return str
  152.    
  153. def CheckAADecoder(str):
  154.     aResult = re.search('([>;]\s*)(゚ω゚.+?\(\'_\'\);)', str, re.DOTALL | re.UNICODE)
  155.     if (aResult):
  156.         VSlog('AA encryption')
  157.  
  158.         #tmp = aResult.group(1) + AADecoder(aResult.group(2)).decode()
  159.  
  160.         JP = JsParser()
  161.         Liste_var = []
  162.  
  163.         try:
  164.             JScode = aResult.group(2)
  165.             JScode = unicode(JScode, "utf-8")
  166.  
  167.             tmp = JP.ProcessJS(JScode, Liste_var)
  168.             tmp = JP.LastEval.decode('string-escape').decode('string-escape')
  169.  
  170.             return str[:aResult.start()] + tmp + str[aResult.end():]
  171.         except:
  172.             return ''
  173.     return str
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement