Пример #1
0
 def getAnimeEpisodeLink(self,episodeStreamItem):
     """
         Method to get all links of an episode
         @return a list of StreamItem
     """
     # ___ Initialize the list to return
     elementList = []
     response = self.openPage(episodeStreamItem.getHref())
     if response is not None and response.getcode()==200:
         content = response.read()
         jsonR = json.loads(content)
         for key in jsonR['episode'].keys():
             if key != 'id' and key != 'manga_id' and key != 'episodeNumber' and key != 'views' and key !='published' and key != 'created_at' and key !='updated_at':
                 if jsonR['episode'][key] is not None :
                     
                     response2 = self.openPage('streamerMEpisode/'+jsonR['episode']['episodeNumber']+'/'+jsonR['episode']['manga_id']+'/'+key)
                     if response2 is not None and response2.getcode()==200:
                         content2 = response2.read()
                         jsonR2 = json.loads(content2)
                         # __ Create the element                       
                         element = episodeStreamItem.copy()
                         element.setAction(StreamItem.ACTION_PLAY)
                         element.setType(StreamItem.TYPE_STREAMING_LINK)
                         element.setHref(jsonR2['code'])           
                         element.setLang(strUtil.getLangFromTitle(key.replace('_',' ')))
                         element.setSubTitle(strUtil.getSubtitleFromTitle(key.replace('_',' ')))
                         element.regenerateKodiTitle()
                     
                         self.appendLinkInList(element, elementList)
                         response2.close()
                
         response.close()                     
                       
     return elementList  
Пример #2
0
 def getTvShowEpisodeLink(self,episodeStreamItem):
     """
         Method to get all links of an episode
         @return a list of StreamItem
     """     
     # ___ Initialize the list to return
     elementList = []
     
     # ___ Get the soup
     
     soupI = self._initOpenPage(episodeStreamItem)
     streamers = soupI.findAll('a', attrs = {'data-streamer' : True})
     
     for streamer in streamers:
         response = self.openPage('streamerSerie/'+streamer['data-id']+'/'+streamer['data-streamer'])
         if response is not None and response.getcode()==200:
             content = response.read()
             jsonR = json.loads(content)
             # __ Create the element                       
             element = episodeStreamItem.copy()
             element.setAction(StreamItem.ACTION_PLAY)
             element.setType(StreamItem.TYPE_STREAMING_LINK)
             element.setHref(jsonR['code'])           
             element.setLang(strUtil.getLangFromTitle(streamer['data-streamer'].replace('_',' ')))
             element.setSubTitle(strUtil.getSubtitleFromTitle(streamer['data-streamer'].replace('_',' ')))
             element.regenerateKodiTitle()
         
             self.appendLinkInList(element, elementList)
                
                               
                       
     return elementList   
Пример #3
0
    def getTopMovie(self, streamItem=False):
        """
            Method to get top movie
            @return a list of StreamItem
        """
        href = ''
        response = self.openPage(href)
        elementList = []

        if response and response.getcode() == 200:
            content = response.read()
            soup = BeautifulSoup(content)

            # For every post, get title and topicLink
            movies = soup.find('ul', {'id': 'tab-popular-2'}).findAll('li')

            for index in range(0, len(movies)):

                movie = movies[index]
                el = movie.find('p', {'class': 'tab-item-title'}).find('a')
                title = el.text.encode('UTF-8')
                title = strUtil.unescapeHtml(str(title))
                # Remove '  Film Complet en Streaming'
                title = self.removeFilmComplet(title)
                self.__LOGGER__.log("Finded title: " + title, xbmc.LOGDEBUG)
                href = el['href']
                year = strUtil.getYearFromTitle(title)
                quality = strUtil.getQualityFromTitle(title)
                lang = strUtil.getLangFromTitle(title)
                title = strUtil.cleanTitle(title)
                self.__LOGGER__.log("Clean title: " + str(title),
                                    xbmc.LOGDEBUG)

                # __ Create the element
                element = StreamItem(title)
                element.setHref(href)
                element.setYear(year)
                element.setQuality(quality)
                element.setLang(lang)
                element.setAction(StreamItem.ACTION_DISPLAY_LINKS)
                element.setType(StreamItem.TYPE_MOVIE)

                # __ Add the element to the list
                elementList.append(element)

        # ___ Error during open last movie page
        else:
            miscFunctions.displayNotification('Unable to get top movie ')
            self.__LOGGER__.log(
                'Connection ERROR : Failed to open page (' +
                self.buildHref(href) + ')', xbmc.LOGERROR)

        return elementList
Пример #4
0
 def getMoviesFromContent(self,content):
     """
         Method to get movies from content
         @param: the html content
         @return the elementList
     """
     elementList = []
     soup = BeautifulSoup(content)
     movies = soup.findAll('div',{'class':'movie'})
     for movie in movies:
         title = movie.find('div',{'class':'infos'}).find('a',{'class':'title'}).find('span').text.encode('UTF-8')
         title = strUtil.unescapeHtml(str(title))
         
         self.__LOGGER__.log("Finded title: "+title,xbmc.LOGDEBUG)
         href = movie.find('div',{'class':'infos'}).find('a',{'class':'title'})['href']
         quality = movie.find('div',{'class':'pic'}).find('span',{'class':'qualitos'}).text.encode('UTF-8') 
         
         title = strUtil.cleanTitle(title)                
         self.__LOGGER__.log("Clean title: "+str(title),xbmc.LOGDEBUG)        
         
         # __ Create the element
         element = StreamItem(title)
         element.setHref(href)
         element.setQuality(quality)
         element.setAction(StreamItem.ACTION_DISPLAY_LINKS)
         element.setType(StreamItem.TYPE_MOVIE)
         element.setSourceId(self.ID)  
         element.setIconImage(movie.find('div',{'class':'pic'}).find('img')['src'])   
         element.setId(movie.find('div',{'class':'infos'}).find('a',{'data-type':'movie'})['data-id'])               
         
         # ___ Get metadatas 
         metadatas = movie.find('div',{'class':'infos'})
        
         
         if metadatas is not None:
             genres = metadatas.findAll('p',{'class':'nop genre meta an'})[0].find('a').text.encode('UTF-8')                                       
             element.setMetadataGenre(genres)                        
             
             year = metadatas.findAll('p',{'class':'nop genre meta an'})[1].find('a').text.encode('UTF-8')   
             element.setMetadataYear(year)
             
             lang = strUtil.getLangFromTitle(metadatas.findAll('p',{'class':'nop genre meta an'})[2].find('img')['alt'])
             element.setLang(lang)
             
         overview = metadatas.find('p',{'class':'nop synopsis meta an'})
         if overview is not None:
             element.setMetadataOverview(overview.text.encode('UTF-8'))
                             
         # __ Add the element to the list
         elementList.append(element)    
         
     
     return elementList
Пример #5
0
    def getMoviesItemFromContent(self, content):
        """
            Method to get movie list
            @param content: the html content
            @return the StreamItem list
        """
        elementList = []
        soup = BeautifulSoup(content)

        # For every post, get title and topicLink
        movies = soup.find('div', {
            'class': 'filmcontent'
        }).findAll('div', {'class': 'moviefilm'})

        for index in range(0, len(movies)):

            movie = movies[index]

            title = movie.find('div', {'class': 'movief'}).text.encode('UTF-8')
            title = strUtil.unescapeHtml(str(title))
            self.__LOGGER__.log("Finded title: " + title, xbmc.LOGDEBUG)
            href = movie.find('div', {'class': 'movief'}).find('a')['href']
            year = strUtil.getYearFromTitle(title)
            quality = strUtil.getQualityFromTitle(title)
            lang = strUtil.getLangFromTitle(title)
            title = strUtil.cleanTitle(title)
            self.__LOGGER__.log("Clean title: " + str(title), xbmc.LOGDEBUG)

            # __ Create the element
            element = StreamItem(title)
            element.setHref(href)
            element.setYear(year)
            element.setQuality(quality)
            element.setLang(lang)
            element.setAction(StreamItem.ACTION_DISPLAY_LINKS)
            element.setType(StreamItem.TYPE_MOVIE)
            element.setSourceId(self.ID)

            # __ Add the element to the list
            elementList.append(element)

        return elementList
Пример #6
0
    def searchMovie(self, title):
        """
            Method to search a movie
            @return a list of StreamItem
        """
        # Use get ?s=300
        get_href = '?s=' + webUtil.encodeStr(title)

        response = self.openPage(get_href)
        elementList = []

        if response and response.getcode() == 200:
            content = response.read()
            soup = BeautifulSoup(content)

            # For every post, get title and topicLink
            if soup.find('div', {'class': 'post-list group'}) is not None:
                movies = soup.find('div', {
                    'class': 'post-list group'
                }).findAll('article')
            else:
                return elementList

            for index in range(0, len(movies)):

                movie = movies[index]
                el = movie.find('h2', {
                    'class': 'post-title entry-title'
                }).find('a')
                title = el.text.encode('UTF-8')
                title = strUtil.unescapeHtml(str(title))
                # Remove '  Film Complet en Streaming'
                title = self.removeFilmComplet(title)
                self.__LOGGER__.log("Finded title: " + title, xbmc.LOGDEBUG)
                href = el['href']
                year = strUtil.getYearFromTitle(title)
                quality = strUtil.getQualityFromTitle(title)
                lang = strUtil.getLangFromTitle(title)
                title = strUtil.cleanTitle(title)
                self.__LOGGER__.log("Clean title: " + str(title),
                                    xbmc.LOGDEBUG)

                # __ Create the element
                element = StreamItem(title)
                element.setHref(href)
                element.setYear(year)
                element.setQuality(quality)
                element.setLang(lang)
                element.setAction(StreamItem.ACTION_DISPLAY_LINKS)
                element.setType(StreamItem.TYPE_MOVIE)
                element.setSourceId(self.ID)

                # __ Add the element to the list
                elementList.append(element)

        # ___ Error during search the movie
        else:
            miscFunctions.displayNotification('Unable to search Movie ' +
                                              title)
            self.__LOGGER__.log(
                'Connection ERROR : Failed to open page (' +
                self.buildHref(get_href) + ')', xbmc.LOGERROR)

        return elementList
Пример #7
0
 def getItemsFromContent(self,content,type):
     """
         Method to get movie list
         @param content: the html content
         @param type: the type to extract
         @return the StreamItem list
     """     
     elementList = []
     soup = BeautifulSoup(content)      
               
     # For every post, get title and topicLink          
     movies = soup.find('div',{'class':'list_f'}).findAll('li',{'class':'item'})
     
     for index in range(0,len(movies)):
         
         movie = movies[index]
         link = movie.find('div',{'class':'info'}).find('h3',{'class':'name'}).find('a')
         title =link.text.encode('UTF-8')
         title = strUtil.unescapeHtml(str(title))
         self.__LOGGER__.log("Finded title: "+title,xbmc.LOGDEBUG)
         href = link['href']
         year = strUtil.getYearFromTitle(title) 
         quality = strUtil.getQualityFromTitle(title)  
         lang = strUtil.getLangFromTitle(title)
         title = strUtil.cleanTitle(title)                
         self.__LOGGER__.log("Clean title: "+str(title),xbmc.LOGDEBUG)        
         
         # __ Create the element
         element = StreamItem(title)
         element.setHref(href)                
         element.setYear(year)             
         element.setQuality(quality)             
         element.setLang(lang) 
         element.setSourceId(self.ID) 
         
         # __ Get the type
         typePattern = re.compile('(http://papystreaming.org/)(.*?)(/.*?/)')
         match = typePattern.match(href)
         typeEl = None
         if match is not None:
             if match.group(2) == 'film':
                 typeEl = StreamItem.TYPE_MOVIE           
                 element.setAction(StreamItem.ACTION_DISPLAY_LINKS)
                 element.setType(StreamItem.TYPE_MOVIE)              
             elif match.group(2) == 'serie':    
                 typeEl = StreamItem.TYPE_TVSHOW           
                 element.setAction(StreamItem.ACTION_DISPLAY_SEASONS)
                 element.setType(StreamItem.TYPE_TVSHOW)  
                 element.setTvShowName(title)   
         
         
         if typeEl is not None and typeEl == int(type):      
             # __ Get the poster
             poster = movie.find('img')['src']
             element.setIconImage(poster)
             
             # __ Set the genre
             genre = movie.find('span',{'class':'genero'}).text.encode('UTF-8')
             element.setMetadataGenre(genre)
             
             # __ Add the element to the list
             elementList.append(element)
     
     return elementList
Пример #8
0
 def searchMovie(self, title):
     """
         Method to search a movie
         @return a list of StreamItem
     """
     # Use post http://mega-stream.fr/recherche
     #
     # search:3
     #
     
     post_href = '/recherche'
     # Data to post
     data = {'search':title}
     response = self.postPage(post_href, data)
     
     elementList = []
     
     if response and response.getcode() == 200:    
         content = response.read()
         soup = BeautifulSoup(content)      
         
         # ___ The first sectio is for movie       
         movies = soup.findAll('div',{'class':'section'})[0].findAll('div',{'class':'movie-item ignore-select'})
         
         for index in range(0,len(movies)):
             
             movie = movies[index] 
                            
             title = movie.find('img')['alt'].encode('UTF-8')
             title = strUtil.unescapeHtml(str(title))
             
             self.__LOGGER__.log("Finded title: "+title,xbmc.LOGDEBUG)
             href = movie.find('div',{'class':'movie-series'}).find('a')['href']
             titleExtract = movie.find('div',{'class':'movie-series'}).find('a').text.encode('UTF-8')
             year = strUtil.getYearFromTitle(titleExtract) 
             quality = strUtil.getQualityFromTitle(titleExtract)  
             lang = strUtil.getLangFromTitle(titleExtract)
             title = strUtil.cleanTitle(title)                
             self.__LOGGER__.log("Clean title: "+str(title),xbmc.LOGDEBUG)        
             
             # __ Create the element
             element = StreamItem(title)
             element.setHref(href)                
             element.setYear(year)             
             if movie.find('span') is not None:
                 element.setQuality(movie.find('span').text.encode('UTF-8'))             
             element.setLang(lang)
             element.setAction(StreamItem.ACTION_DISPLAY_LINKS)
             element.setType(StreamItem.TYPE_MOVIE)
             element.setSourceId(self.ID)  
             element.setIconImage(movie.find('img')['src'])                  
                             
             
             # __ Add the element to the list
             elementList.append(element)
     
         
         
     # ___ Error during search the movie
     else:
         miscFunctions.displayNotification('Unable to search Movie ' + title)                   
         self.__LOGGER__.log('Connection ERROR : Failed to open page (' + self.buildHref(post_href) + ')', xbmc.LOGERROR)
 
     return elementList
Пример #9
0
 def getLastAnime(self,streamItem=False):
     """
         Method to get all last anime
         @return a list of StreamItem
     """
     
     # ___ Initialize the list to return
     elementList = []
     
     href = '/accueil-mangas'
     page = 0
     # ___ Get the page
     if streamItem and streamItem.getPage() is not None and len(streamItem.getPage()) > 0:
         href = href +'/page/' +streamItem.getPage()
         page = streamItem.getPage()
     
         
     # ___ Get the soup
     response = self.openPage(href)
     
     if response and response.getcode() == 200:        
         content = response.read()
         soup = BeautifulSoup(content)  
         if soup is not None:
             movies = soup.find('div',{'id':'dle-content'}).findAll('div',{ 'class':'movie-item ignore-select short-movie clearfix'})
             
             for movie in movies:
                                                
                 title = movie.find('img')['alt'].encode('UTF-8')
                 title = strUtil.unescapeHtml(str(title))
                 
                 self.__LOGGER__.log("Finded title: "+title,xbmc.LOGDEBUG)
                 href = movie.find('a',{'class':'movie-title'})['href']
                 titleExtract = movie.find('a',{'class':'movie-title'}).text.encode('UTF-8')
                 year = strUtil.getYearFromTitle(titleExtract) 
                 quality = strUtil.getQualityFromTitle(titleExtract)  
                 lang = strUtil.getLangFromTitle(titleExtract)
                 title = strUtil.cleanTitle(title)                
                 self.__LOGGER__.log("Clean title: "+str(title),xbmc.LOGDEBUG)        
                 
                 # __ Create the element
                 element = StreamItem(title)
                 element.setTvShowName(title)
                 element.setHref(href)                
                 element.setYear(year)             
                 if movie.find('span') is not None:
                     element.setQuality(movie.find('span').text.encode('UTF-8'))             
                 element.setLang(lang)
                 element.setAction(StreamItem.ACTION_DISPLAY_SEASONS)
                 element.setType(StreamItem.TYPE_TVSHOW)                    
                 element.setSourceId(self.ID)  
                 element.setIconImage(movie.find('img')['src'])                    
                 
                 # ___ Get metadatas 
                 metadatas = movie.find('div',{'class':'movie-desc'})
                
                 metas = metadatas.findAll('div',{'class':'movie-director'})
                 if metas is not None:
                     genres = metas[0].text.encode('UTF-8')
                     genres = genres.replace(metas[0].find('b').text.encode('UTF-8'),'').strip()                     
                     element.setMetadataGenre(genres)                        
                     
                     year = metas[1].text.encode('UTF-8')
                     year = year.replace(metas[1].find('b').text.encode('UTF-8'),'')
                     year = year[len(year)-5:len(year)]
                     element.setMetadataYear(year)
                     
                 overview = metadatas.find('div',{'class':'movie-text'})
                 if overview is not None:
                     element.setMetadataOverview(overview.text.encode('UTF-8'))
                                     
                 # __ Add the element to the list
                 elementList.append(element)      
         
         nextPage = StreamItem(constant.__addon__.getLocalizedString(70010))
         nextPage.setIconImage(icons.getIcon('nextpage'))
         nextPage.setType(StreamItem.TYPE_TVSHOW)
         nextPage.setAction(StreamItem.ACTION_DISPLAY_TYPE_LIST)
         nextPage.setSubType(StreamItem.SUBTYPE_LAST)
         nextPage.setPage(int(page)+1)
         elementList.append(nextPage)
         
                 
     return elementList  
Пример #10
0
    def getItemsFromContent(self,content,type):
        """
            Method to get movie list
            @param content: the html content
            @param type: the type to extract
            @return the StreamItem list
        """
        elementList = []
        typeEl = None
        results = json.loads(content)

        if results is not None and len(results)>0:           
            for result in results:
                detail = result['result']
                title =detail['title'].encode('UTF-8')
                title = strUtil.unescapeHtml(str(title))
                self.__LOGGER__.log("Finded title: "+title,xbmc.LOGDEBUG)
                href = detail['url']
                year=None
                quality=None
                lang=None
                if 'anneeProduction' in detail:
                    year = detail['anneeProduction']                    
                if 'qualite' in detail:
                    quality = detail['qualite']                  
                if 'langue' in detail:
                    lang = strUtil.getLangFromTitle(detail['langue'])
                self.__LOGGER__.log("Clean title: "+str(title),xbmc.LOGDEBUG)        
                
                # __ Create the element
                element = StreamItem(title)
                element.setHref(href)  
                if year is not None:                
                    element.setYear(year)             
                if quality is not None:  
                    element.setQuality(quality) 
                if lang is not None:            
                    element.setLang(lang) 
                element.setId(detail['id'])
                element.setSourceId(self.ID) 
                
                # __ Get the type
                if result['type'] == 'Film':
                        typeEl = StreamItem.TYPE_MOVIE           
                        element.setAction(StreamItem.ACTION_DISPLAY_LINKS)
                        element.setType(StreamItem.TYPE_MOVIE)              
                elif strUtil.deleteAccent(result['type']) == 'Serie':
                    typeEl = StreamItem.TYPE_TVSHOW           
                    element.setAction(StreamItem.ACTION_DISPLAY_SEASONS)
                    element.setType(StreamItem.TYPE_TVSHOW)  
                    element.setTvShowName(title)   
                elif result['type'] == 'Manga':  
                    typeEl = StreamItem.TYPE_ANIME           
                    element.setAction(StreamItem.ACTION_DISPLAY_EPISODES)
                    element.setType(StreamItem.TYPE_ANIME)  
                    element.setTvShowName(title)   
                
                
                if typeEl is not None and typeEl == int(type):      
                    # __ Get the poster
                    element.setIconImage(self.buildHref('/cdn/img/'+detail['img']))
                    
                    # __ Set the genre
                    if 'genre' in detail:
                        element.setMetadataGenre(detail['genre'])
                    
                    # __ Add the element to the list
                    elementList.append(element)
        
        return elementList