mino60

Untitled

Jul 4th, 2016
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 12.31 KB | None | 0 0
  1. #-*- coding: utf-8 -*-
  2. #Venom.
  3. from resources.lib.gui.hoster import cHosterGui
  4. from resources.lib.handler.hosterHandler import cHosterHandler
  5. from resources.lib.gui.gui import cGui
  6. from resources.lib.gui.guiElement import cGuiElement
  7. from resources.lib.handler.inputParameterHandler import cInputParameterHandler
  8. from resources.lib.handler.outputParameterHandler import cOutputParameterHandler
  9. from resources.lib.handler.requestHandler import cRequestHandler
  10. from resources.lib.config import cConfig
  11. from resources.lib.parser import cParser
  12. from resources.lib.util import cUtil
  13. from resources.lib.player import cPlayer
  14. import re,urllib2,urllib
  15.  
  16. SITE_IDENTIFIER = 'film_streaming_co'
  17. SITE_NAME = 'Film-streaming.co'
  18. SITE_DESC = 'Le seul site de streaming en HD 720p 100% Gratuit'
  19.  
  20. URL_MAIN = 'http://www.film-streaming.co/'
  21.  
  22. MOVIE_NEWS = ('http://www.film-streaming.co/index.php', 'showMovies')
  23. MOVIE_FILMS = ('http://www.film-streaming.co/films.php', 'showMovies')
  24. MOVIE_TOP = ('http://www.film-streaming.co/top.php', 'showMovies')
  25.  
  26.  
  27. MOVIE_GENRES = (True, 'showGenre')
  28.  
  29.  
  30. URL_SEARCH = ('http://www.film-streaming.co/search.php?movie=', 'resultSearch')
  31. FUNCTION_SEARCH = 'resultSearch'
  32.    
  33. def load():
  34.     oGui = cGui()
  35.  
  36.     oOutputParameterHandler = cOutputParameterHandler()
  37.     oOutputParameterHandler.addParameter('siteUrl', 'http://venom/')
  38.     oGui.addDir(SITE_IDENTIFIER, 'showSearch', 'Recherche', 'search.png', oOutputParameterHandler)
  39.  
  40.     oOutputParameterHandler = cOutputParameterHandler()
  41.     oOutputParameterHandler.addParameter('siteUrl', MOVIE_NEWS[0])
  42.     oGui.addDir(SITE_IDENTIFIER, 'showMovies', 'Films Nouveautés', 'news.png', oOutputParameterHandler)
  43.     oGui.addDir(SITE_IDENTIFIER, 'showSearch', 'Recherche', 'search.png', oOutputParameterHandler)
  44.        
  45.     oOutputParameterHandler = cOutputParameterHandler()
  46.     oOutputParameterHandler.addParameter('siteUrl', MOVIE_TOP[0])
  47.     oGui.addDir(SITE_IDENTIFIER, 'showMovies', 'Top Films', 'top.png', oOutputParameterHandler)
  48.    
  49.     oOutputParameterHandler = cOutputParameterHandler()
  50.     oOutputParameterHandler.addParameter('siteUrl', MOVIE_FILMS[0])
  51.     oGui.addDir(SITE_IDENTIFIER, 'showMovies', 'Tout Les Films', 'films.png', oOutputParameterHandler)
  52.    
  53.     oOutputParameterHandler = cOutputParameterHandler()
  54.     oOutputParameterHandler.addParameter('siteUrl', 'http://venom')
  55.     oGui.addDir(SITE_IDENTIFIER, 'showGenre', 'Films Genre', 'genres.png', oOutputParameterHandler)
  56.            
  57.     oGui.setEndOfDirectory()
  58.  
  59.  
  60. def showSearch():
  61.     oGui = cGui()
  62.  
  63.     sSearchText = oGui.showKeyBoard()
  64.     if (sSearchText != False):
  65.         sSearchText = cUtil().urlEncode(sSearchText)
  66.         sUrl = 'http://www.film-streaming.co/search.php?movie='+sSearchText
  67.         resultSearch(sUrl)
  68.         oGui.setEndOfDirectory()
  69.         return
  70.  
  71. def showPage():
  72.     oGui = cGui()
  73.  
  74.     sSearchNum = oGui.showNumBoard()
  75.    
  76.     if (sSearchNum):
  77.  
  78.         oInputParameterHandler = cInputParameterHandler()
  79.         sUrl = oInputParameterHandler.getValue('siteUrlbase')
  80.         sMaxPage = oInputParameterHandler.getValue('MaxPage')
  81.        
  82.         sSearchNum = str(sSearchNum)
  83.        
  84.         if int(sSearchNum) > int (sMaxPage):
  85.             sSearchNum = sMaxPage
  86.            
  87.         sUrl = sUrl + str(sSearchNum)
  88.        
  89.         showMovies(sUrl)
  90.         oGui.setEndOfDirectory()
  91.         return
  92.  
  93.    
  94. def showGenre():
  95.     oGui = cGui()
  96.     oInputParameterHandler = cInputParameterHandler()
  97.     sUrl = oInputParameterHandler.getValue('siteUrl')
  98.  
  99.     liste = []
  100.     liste.append( ['Animation','http://www.film-streaming.co/genre.php?g=Animation'] )    
  101.     liste.append( ['Action','http://www.film-streaming.co/genre.php?g=Action'] )
  102.     liste.append( ['Arts Martiaux','http://www.film-streaming.co/genre.php?g=Arts%20Martiaux'] )
  103.     liste.append( ['Aventure','http://www.film-streaming.co/genre.php?g=Aventure'] )
  104.     liste.append( ['Biopic','http://www.film-streaming.co/genre.php?g=Biopic'] )
  105.     liste.append( ['Comedie','http://www.film-streaming.co/genre.php?g=Com%C3%A9die'] )
  106.     liste.append( ['Comedie Dramatique','http://www.film-streaming.co/genre.php?g=Com%C3%A9die%20dramatique'] )
  107.     liste.append( ['Documentaire','http://www.film-streaming.co/genre.php?g=Documentaire'] )
  108.     liste.append( ['Drame','http://www.film-streaming.co/genre.php?g=Drame'] )
  109.     liste.append( ['Epouvante Horreur','http://www.film-streaming.co/genre.php?g=Epouvante-horreur'] )
  110.     liste.append( ['Espionage','http://www.film-streaming.co/genre.php?g=Espionnage'] )  
  111.     liste.append( ['Fantastique','http://www.film-streaming.co/genre.php?g=Fantastique'] )
  112.     liste.append( ['Famille','http://www.film-streaming.co/genre.php?g=Famille'] )
  113.     liste.append( ['Guerre','http://www.film-streaming.co/genre.php?g=Guerre'] )
  114.     liste.append( ['Historique','http://www.film-streaming.co/genre.php?g=Historique'] )
  115.     liste.append( ['Musical','http://www.film-streaming.co/genre.php?g=Musical'] )
  116.     liste.append( ['Policier','http://www.film-streaming.co/genre.php?g=Policier'] )
  117.     liste.append( ['Romance','http://www.film-streaming.co/genre.php?g=Romance'] )
  118.     liste.append( ['Sciense Fiction','http://www.film-streaming.co/genre.php?g=Science%20fiction'] )
  119.     liste.append( ['Thriller','http://www.film-streaming.co/genre.php?g=Thriller'] )
  120.     liste.append( ['Western','http://www.film-streaming.co/genre.php?g=Western'] )
  121.                
  122.     for sTitle,sUrl in liste:
  123.        
  124.         oOutputParameterHandler = cOutputParameterHandler()
  125.         oOutputParameterHandler.addParameter('siteUrl', sUrl)
  126.         oGui.addDir(SITE_IDENTIFIER, 'showMovies', sTitle, 'genres.png', oOutputParameterHandler)
  127.        
  128.     oGui.setEndOfDirectory()
  129.    
  130. def resultSearch(sSearch = ''):
  131.     oGui = cGui()  
  132.     if sSearch:
  133.       sUrl = sSearch
  134.     else:
  135.         oInputParameterHandler = cInputParameterHandler()
  136.         sUrl = oInputParameterHandler.getValue('siteUrl')
  137.    
  138.     oRequestHandler = cRequestHandler(sUrl)
  139.     sHtmlContent = oRequestHandler.request();
  140.     sPattern = '<td class="wrapper_pic_td"><img src="(.+?)" border="0" alt="(.+?)\sStreaming".+?></td>.+?<span class="std">(.+?)</span>'
  141.    
  142.     oParser = cParser()
  143.     aResult = oParser.parse(sHtmlContent, sPattern)
  144.    
  145.     if (aResult[0] == True):
  146.         total = len(aResult[1])
  147.         dialog = cConfig().createDialog(SITE_NAME)
  148.         for aEntry in aResult[1]:
  149.             cConfig().updateDialog(dialog, total)
  150.             if dialog.iscanceled():
  151.                 break
  152.  
  153.             sThumbnail = URL_MAIN+str(aEntry[0])
  154.             oOutputParameterHandler = cOutputParameterHandler()
  155.             oOutputParameterHandler.addParameter('siteUrl', str(sUrl))
  156.             oOutputParameterHandler.addParameter('sMovieTitle', str(aEntry[1]))
  157.             oOutputParameterHandler.addParameter('sThumbnail', str(sThumbnail))
  158.             oGui.addMovie(SITE_IDENTIFIER, 'showHosters', aEntry[1], 'films.png', sThumbnail, aEntry[2], oOutputParameterHandler)
  159.        
  160.         cConfig().finishDialog(dialog)
  161.        
  162.     if not sSearch:      
  163.         oGui.setEndOfDirectory()
  164.        
  165.        
  166.        
  167. def showMovies(sSearch = ''):
  168.     oGui = cGui()
  169.    
  170.     if sSearch:
  171.       sUrl = sSearch
  172.     else:
  173.         oInputParameterHandler = cInputParameterHandler()
  174.         sUrl = oInputParameterHandler.getValue('siteUrl')
  175.    
  176.     oRequestHandler = cRequestHandler(sUrl)
  177.     sHtmlContent = oRequestHandler.request()
  178.     sHtmlContent = sHtmlContent.replace('<span class="likeThis">', '').replace('</span>','')
  179.  
  180.     sPattern = '<td.+?class="over_modul">.+?<a href="(.+?)"><img src="(.+?)" border="0" alt="(.+?)\sstreaming".+?</a>'    
  181.  
  182.     oParser = cParser()
  183.     aResult = oParser.parse(sHtmlContent, sPattern)
  184.    
  185.     if (aResult[0] == True):
  186.         total = len(aResult[1])
  187.         dialog = cConfig().createDialog(SITE_NAME)
  188.         for aEntry in aResult[1]:
  189.             cConfig().updateDialog(dialog, total)
  190.             if dialog.iscanceled():
  191.                 break
  192.            
  193.             sThumbnail = URL_MAIN+str(aEntry[1])
  194.             siteUrl = URL_MAIN+str(aEntry[0])
  195.  
  196.             oOutputParameterHandler = cOutputParameterHandler()
  197.             oOutputParameterHandler.addParameter('siteUrl', siteUrl)
  198.             oOutputParameterHandler.addParameter('sMovieTitle', str(aEntry[2]))
  199.             oOutputParameterHandler.addParameter('sThumbnail', sThumbnail)            
  200.             oGui.addMovie(SITE_IDENTIFIER, 'showHosters', aEntry[2], 'films.png', sThumbnail, '', oOutputParameterHandler)
  201.            
  202.         cConfig().finishDialog(dialog)
  203.  
  204.         sNextPage = __checkForNextPage(sHtmlContent)
  205.         if (sNextPage != False):
  206.             oOutputParameterHandler = cOutputParameterHandler()
  207.             oOutputParameterHandler.addParameter('siteUrl', sNextPage[1] + str(int(sNextPage[0]) + 1))
  208.             oGui.addDir(SITE_IDENTIFIER, 'showMovies', '[COLOR white]Page: [/COLOR][COLOR yellow]' + sNextPage[0] + '[/COLOR][COLOR white] sur [/COLOR][COLOR magenta]' + sNextPage[2] + '[/COLOR][COLOR white] >>> [/COLOR]', 'next.png', oOutputParameterHandler)
  209.        
  210.             oOutputParameterHandler = cOutputParameterHandler()
  211.             oOutputParameterHandler.addParameter('siteUrlbase', sNextPage[1])
  212.             oOutputParameterHandler.addParameter('MaxPage', sNextPage[2])
  213.             oGui.addDir(SITE_IDENTIFIER, 'showPage', '[COLOR lime]Choisir Page >>> [/COLOR]', 'page.png', oOutputParameterHandler)
  214.  
  215.         sSearch = FUNCTION_SEARCH
  216.         if (sSearch != False):
  217.             oOutputParameterHandler = cOutputParameterHandler()
  218.             oOutputParameterHandler.addParameter('resultSearch', showSearch)
  219.             oGui.addDir(SITE_IDENTIFIER, 'showSearch', '[COLOR aqua]Recherche >>> [/COLOR]', 'search.png', oOutputParameterHandler)
  220.  
  221.     oGui.setEndOfDirectory()
  222.          
  223. def __checkForNextPage(sHtmlContent):
  224.     #sPattern = '<(?:strong class="current"|span class="btn btn-default active")>([0-9]+) *<.+?<span class="btn btn-default">\.\.\. *<a class="btn btn-default" href="([^<>"]+?=)[0-9]+">([0-9]+)<\/a>'
  225.     sPattern = '<(?:strong class="current"|span class="btn btn-default active")>([0-9]+) *<.+?class="btn btn-default" href="([^<>"]+?=)[0-9]+".*?>([0-9]+)<(?!.+?>[0-9]+<.+?)(.+?)<\/td>'
  226.    
  227.     #fh = open('c://test.txt', "w")
  228.     #fh.write(sHtmlContent)
  229.     #fh.close()
  230.  
  231.     oParser = cParser()
  232.     aResult = oParser.parse(sHtmlContent, sPattern)
  233.    
  234.     if (aResult[0] == True):
  235.         #aResult[1][0][0] num current page
  236.         #aResult[1][0][1] url vierge url.php?page=
  237.         #aResult[1][0][2] num derniere page
  238.        
  239.         return aResult[1][0][0], URL_MAIN + aResult[1][0][1], aResult[1][0][2]
  240.  
  241.     return False
  242.  
  243. def showHosters():
  244.    
  245.     oInputParameterHandler = cInputParameterHandler()
  246.     sUrl = oInputParameterHandler.getValue('siteUrl')
  247.     sMovieTitle = oInputParameterHandler.getValue('sMovieTitle')
  248.     sThumbnail  = oInputParameterHandler.getValue('sThumbnail')
  249.    
  250.     oRequestHandler = cRequestHandler(sUrl)
  251.     sHtmlContent = oRequestHandler.request()
  252.      
  253.     url = ''
  254.    
  255.     oParser = cParser()
  256.     sPattern = 'document.write\(unescape\("(.+?)"\)\);'
  257.     aResult = oParser.parse(sHtmlContent, sPattern)
  258.    
  259.     if (aResult[0] == True):
  260.         chainedecrypte = urllib.unquote(aResult[1][0])
  261.         sPattern = 'file: "(http.+?mp4)"'
  262.         aResult = re.findall(sPattern,chainedecrypte)
  263.         if (aResult):
  264.             url = aResult[0]
  265.    
  266.     #dialogue final
  267.     if (url):
  268.  
  269.         sHosterUrl = str(url)
  270.         oHoster = cHosterGui().checkHoster(sHosterUrl)
  271.        
  272.         if (oHoster != False):
  273.             sHosterUrl = sHosterUrl + '|Referer=' + sUrl.replace(URL_MAIN,'http://www.hd-stream.in/')
  274.             oGuiElement = cGuiElement()
  275.             oGuiElement.setSiteName(SITE_IDENTIFIER)
  276.             oGuiElement.setTitle(sMovieTitle)
  277.             oGuiElement.setMediaUrl(sHosterUrl)
  278.             oGuiElement.setThumbnail(sThumbnail)
  279.  
  280.             oPlayer = cPlayer()
  281.             oPlayer.clearPlayList()
  282.             oPlayer.addItemToPlaylist(oGuiElement)
  283.             oPlayer.startPlayer()
  284.            
  285.             #oHoster.setDisplayName(sMovieTitle)
  286.             #oHoster.setFileName(sMovieTitle)
  287.             #cHosterGui().showHoster(oGui, oHoster, sHosterUrl, '')
  288.              
  289.         #cConfig().finishDialog(dialog)
Add Comment
Please, Sign In to add comment