Ejemplo n.º 1
0
    def sources(self, url, hostDict, hostprDict):
        sources = []
        try:
            if not url:
                return sources
            episode = None
            season = None
            if isinstance(url, list):
                season, episode, url = url
            url = urlparse.urljoin(self.base_link, url)
            
            content = cache.get(client.request, 4, url)
            link = dom_parser.parse_dom(content, 'div', attrs={'id': 'full-video'})
            if season:
                link = re.findall("vk.show\(\d+,(.*?)\)", link[0].content)[0]
                link = re.findall("\[(.*?)\]", link)[int(season)-1]
                link = re.findall("'(.*?)'", link)
                sources = hdgo.getStreams(link[int(episode)-1], sources)
            else:
                link = dom_parser.parse_dom(link, 'iframe')
                sources = hdgo.getStreams(link[0].attrs['src'], sources)

            if len(sources) == 0:
                raise Exception()
            return sources
        except:
            source_faultlog.logFault(__name__, source_faultlog.tagScrape, url)
            return sources
    def sources(self, url, hostDict, hostprDict):
        sources = []
        try:
            if not url:
                return sources
            episode = None
            if isinstance(url, list):
                episode, url = url
            url = urlparse.urljoin(self.base_link, url)

            content = client.request(url)
            link = dom_parser.parse_dom(content, 'div', attrs={'id': 'full-video'})
            link = dom_parser.parse_dom(link, 'iframe')

            if len(link) > 0:
                if episode:
                    links = hdgo.getPlaylistLinks(link[0].attrs['src'])
                    link = links[int(episode)-1]
                    sources = hdgo.getStreams(link, sources)
                else:
                    sources = hdgo.getStreams(link[0].attrs['src'], sources)

            return sources
        except:
            source_faultlog.logFault(__name__, source_faultlog.tagScrape)
            return sources
    def sources(self, url, hostDict, hostprDict):
        sources = []
        try:
            if not url:
                return sources
            episode = None
            season = None
            if isinstance(url, list):
                season, episode, url = url
            url = urlparse.urljoin(self.base_link, url)

            oRequest = cRequestHandler(url, caching=False)
            content = oRequest.request()
            link = dom_parser.parse_dom(content,
                                        'div',
                                        attrs={'id': 'full-video'})
            if season:
                try:
                    link = re.findall("vk.show\(\d+,(.*?)\)",
                                      link[0].content)[0]
                    link = re.findall("\[(.*?)\]", link)[int(season) - 1]
                    link = re.findall("'(.*?)'", link)
                    sources = hdgo.getStreams(link[int(episode) - 1], sources)
                except:
                    #we have a tvshow, but no seasons to choose
                    #cinemaxx can host specific seasons, its stated in the url (i.e. http://cinemaxx.cc/serien/743-homeland-7-staffel.html)
                    if season + "-staffel" in url:
                        link = dom_parser.parse_dom(link, 'iframe')
                        episode_links = hdgo.getPlaylistLinks(
                            link[0].attrs['src'])
                        hdgo.getStreams(episode_links[int(episode) - 1],
                                        sources,
                                        skiplast=False)
                    else:
                        pass

            else:
                link = dom_parser.parse_dom(link, 'iframe')
                sources = hdgo.getStreams(link[0].attrs['src'], sources)

            if len(sources) == 0:
                raise Exception()
            return sources
        except:
            source_faultlog.logFault(__name__, source_faultlog.tagScrape, url)
            return sources
    def sources(self, url, hostDict, hostprDict):
        sources = []
        try:
            if not url:
                return sources

            query = urlparse.urljoin(self.base_link, url)

            oRequest = cRequestHandler(query)
            oRequest.removeBreakLines(False)
            oRequest.removeNewLines(False)
            r = oRequest.request()

            quality = dom_parser.parse_dom(
                r, 'span',
                attrs={'id': 'release_text'})[0].content.split(' ')[0]
            quality, info = source_utils.get_release_quality(quality)

            r = dom_parser.parse_dom(r,
                                     'ul',
                                     attrs={'class': 'currentStreamLinks'})
            r = [(dom_parser.parse_dom(i, 'p', attrs={'class': 'hostName'}),
                  re.findall(r' data-player-url="(.*?)">', i.content))
                 for i in r]
            r = [(re.sub('\shd', '', i[0][0].content.lower()), i[1][0])
                 for i in r if i[0] and i[1]]

            for hoster, id in r:
                if 'verystream' in hoster:
                    sources = hdgo.getStreams(id, sources)
                else:
                    valid, hoster = source_utils.is_host_valid(
                        hoster, hostDict)
                    if not valid:
                        continue
                    sources.append({
                        'source': hoster,
                        'quality': quality,
                        'language': 'de',
                        'info': '',
                        'url': id,
                        'direct': False,
                        'debridonly': False,
                        'checkquality': True
                    })

            if len(sources) == 0:
                raise Exception()
            return sources
        except:
            source_faultlog.logFault(__name__, source_faultlog.tagScrape, url)
            return sources
    def sources(self, url, hostDict, hostprDict):
        sources = []
        try:
            if not url:
                return sources

            data = urlparse.parse_qs(url)
            data = dict([(i, data[i][0]) if data[i] else (i, '')
                         for i in data])
            url = urlparse.urljoin(self.base_link, data.get('url', ''))
            season = data.get('season')
            episode = data.get('episode')

            sHtmlContent = self.scraper.get(url).content

            quality = "SD"

            # do we have multiple hoster?
            # i.e. http://kinoger.com/stream/1911-bloodrayne-2-deliverance-2007.html
            link_containers = dom_parser.parse_dom(sHtmlContent, "section")
            if len(
                    link_containers
            ) == 0:  #only one, i.e. http://kinoger.com/stream/890-lucy-2014.html
                #only one
                link_containers = dom_parser.parse_dom(
                    sHtmlContent, "div", attrs={"id": "container-video"})

            for container in link_containers:
                #3 different types found till now: hdgo.show, namba.show and direct (mail.ru etc.)
                # i.e. http://kinoger.com/stream/1911-bloodrayne-2-deliverance-2007.html

                if ".show" in container.content:
                    pattern = ',\[\[(.*?)\]\]'
                    links = re.compile(pattern,
                                       re.DOTALL).findall(container.content)
                    if len(links) == 0: continue
                    #split them up to get season and episode
                    season_array = links[0].split("],[")

                    source_link = None
                    if season and episode:
                        if len(season_array) < int(season):
                            continue
                        episode_array = season_array[int(season) -
                                                     1].split(",")
                        if len(episode_array) < int(episode):
                            continue
                        source_link = episode_array[int(episode) - 1]
                    elif len(season_array) == 1:
                        source_link = season_array[0]

                    if source_link:
                        source_link = source_link.strip("'")
                        if "hdgo" in container.content:
                            sources = hdgo.getStreams(source_link, sources)

                        elif "namba" in container.content:
                            sources.append({
                                'source':
                                'kinoger.com',
                                'quality':
                                quality,
                                'language':
                                'de',
                                'url':
                                "http://v1.kinoger.pw/vod/" + source_link,
                                'direct':
                                False,
                                'debridonly':
                                False,
                                'checkquality':
                                True
                            })

                elif "iframe" in container.content:
                    frame = dom_parser.parse_dom(container.content, "iframe")
                    if len(frame) == 0:
                        continue
                    if 'hdgo' in frame[0].attrs["src"]:
                        sources = hdgo.getStreams(frame[0].attrs["src"],
                                                  sources)

                    else:
                        valid, host = source_utils.is_host_valid(
                            frame[0].attrs["src"], hostDict)
                        if not valid: continue

                        sources.append({
                            'source': host,
                            'quality': quality,
                            'language': 'de',
                            'url': frame[0].attrs["src"],
                            'direct': False,
                            'debridonly': False,
                            'checkquality': True
                        })

                else:
                    continue

            return sources
        except:
            source_faultlog.logFault(__name__, source_faultlog.tagScrape)
            return sources