Ejemplo n.º 1
0
    def get_sources(self, video):
        source_url = self.get_url(video)
        hosters = []
        if not source_url or source_url == FORCE_NO_MATCH: return hosters
        url = scraper_utils.urljoin(self.base_url, source_url)
        html = self._http_get(url, cache_limit=.5)

        pattern = "/w\.php\?q=([^']+)"
        seen_hosts = {}
        for match in re.finditer(pattern, html, re.DOTALL):
            url = match.group(1)
            hoster = {
                'multi-part': False,
                'url': url.decode('base-64'),
                'class': self,
                'quality': None,
                'views': None,
                'rating': None,
                'direct': False
            }
            hoster['host'] = urlparse.urlsplit(hoster['url']).hostname
            # top list is HD, bottom list is SD
            if hoster['host'] in seen_hosts:
                quality = QUALITIES.HIGH
            else:
                quality = QUALITIES.HD720
                seen_hosts[hoster['host']] = True
            hoster['quality'] = scraper_utils.get_quality(
                video, hoster['host'], quality)
            hosters.append(hoster)
        return hosters
Ejemplo n.º 2
0
 def get_sources(self, video):
     hosters = []
     source_url = self.get_url(video)
     if not source_url or source_url == FORCE_NO_MATCH: return hosters
     url = scraper_utils.urljoin(self.base_url, source_url)
     html = self._http_get(url, cache_limit=.5)
     for _attrs, td in dom_parser2.parse_dom(html, 'td',
                                             {'class': 'tdhost'}):
         match = dom_parser2.parse_dom(td, 'a', req='href')
         if match:
             stream_url = match[0].attrs['href']
             host = urlparse.urlparse(stream_url).hostname
             quality = scraper_utils.get_quality(video, host,
                                                 QUALITIES.HIGH)
             hoster = {
                 'multi-part': False,
                 'host': host,
                 'class': self,
                 'url': stream_url,
                 'quality': quality,
                 'views': None,
                 'rating': None,
                 'direct': False
             }
             hosters.append(hoster)
     return hosters
Ejemplo n.º 3
0
    def get_sources(self, video):
        source_url = self.get_url(video)
        hosters = []
        if source_url and source_url != FORCE_NO_MATCH:
            page_url = urlparse.urljoin(self.base_url, source_url)
            html = self._http_get(page_url, cache_limit=.25)
            for button in dom_parser.parse_dom(html, 'li',
                                               {'class': 'playing_button'}):
                try:
                    link = dom_parser.parse_dom(button, 'a', ret='href')
                    match = re.search('php\?.*?=?([^"]+)', link[0])
                    stream_url = base64.b64decode(match.group(1))
                    match = re.search('(http://.*)', stream_url)
                    stream_url = match.group(1)
                    host = urlparse.urlparse(stream_url).hostname
                    quality = scraper_utils.get_quality(
                        video, host, QUALITIES.HIGH)
                    hoster = {
                        'multi-part': False,
                        'host': host,
                        'class': self,
                        'quality': quality,
                        'views': None,
                        'rating': None,
                        'url': stream_url,
                        'direct': False
                    }
                    hosters.append(hoster)
                except Exception as e:
                    log_utils.log(
                        'Exception during tvonline source: %s - |%s|' %
                        (e, button), log_utils.LOGDEBUG)

        return hosters
Ejemplo n.º 4
0
    def get_sources(self, video):
        source_url = self.get_url(video)
        hosters = []
        if source_url and source_url != FORCE_NO_MATCH:
            url = urlparse.urljoin(self.base_url, self.goog, source_url)
            html = self._http_get(url, cache_limit=.5)

            match = re.search('This movie is of poor quality', html, re.I)
            if match:
                quality = QUALITIES.LOW
            else:
                quality = QUALITIES.HIGH

            for match in re.finditer('href="([^"]+/embed\d*/[^"]+)', html):
                url = match.group(1)
                embed_html = self._http_get(url, cache_limit=.5)
                hosters += self.__get_links(embed_html)
            
            pattern = 'href="([^"]+)[^>]*>\s*<[^>]+play_video.gif'
            for match in re.finditer(pattern, html, re.I):
                stream_url = match.group(1)
                host = urlparse.urlparse(stream_url).hostname
                quality = scraper_utils.get_quality(video, host, quality)
                hoster = {'multi-part': False, 'url': stream_url, 'host': host, 'class': self, 'quality': quality, 'rating': None, 'views': None, 'direct': False}
                hosters.append(hoster)
        return hosters
Ejemplo n.º 5
0
    def get_sources(self, video):
        hosters = []
        source_url = self.get_url(video)
        if not source_url or source_url == FORCE_NO_MATCH: return hosters
        url = scraper_utils.urljoin(self.base_url, source_url)
        headers = {'Referer': self.base_url}
        html = self._http_get(url, headers=headers, cache_limit=.5)
        for _attrs, fragment in dom_parser2.parse_dom(html, 'div',
                                                      {'class': 'lang'}):
            section_label = dom_parser2.parse_dom(
                fragment, 'div',
                {'title': re.compile('Language Flag\s+[^"]*')})
            lang, subs = self.__get_section_label(section_label)
            if lang.lower() == 'english':
                for attrs, host in dom_parser2.parse_dom(fragment,
                                                         'a', {'class': 'p1'},
                                                         req='href'):
                    stream_url = attrs['href']
                    quality = scraper_utils.get_quality(
                        video, host, QUALITIES.HIGH)
                    hoster = {
                        'multi-part': False,
                        'url': stream_url,
                        'class': self,
                        'quality': quality,
                        'host': host,
                        'rating': None,
                        'views': None,
                        'direct': False
                    }
                    if subs: hoster['subs'] = subs
                    hosters.append(hoster)

        return hosters
Ejemplo n.º 6
0
    def __get_links(self, url, video):
        hosters = []
        seen_urls = set()
        for search_type in SEARCH_TYPES:
            search_url, params = self.__translate_search(url, search_type)
            if not search_url: continue
            html = self._http_get(search_url, params=params, cache_limit=.5)
            js_result = scraper_utils.parse_json(html, search_url)
            if js_result.get('status') != 'success':
                logger.log('Pron API Error: |%s|%s|: %s' % (search_url, params, js_result.get('message', 'Unknown Error')), log_utils.LOGWARNING)
                continue
            
            for result in js_result['result']:
                stream_url = result['hosterurls'][0]['url']
                if len(result['hosterurls']) > 1: continue
                if result['extension'] == 'rar': continue
                if stream_url in seen_urls: continue

                if scraper_utils.release_check(video, result['title']):
                    host = urlparse.urlsplit(stream_url).hostname
                    quality = scraper_utils.get_quality(video, host, self._get_title_quality(result['title']))
                    hoster = {'multi-part': False, 'class': self, 'views': None, 'url': stream_url, 'rating': None, 'host': host, 'quality': quality, 'direct': False}
                    hoster['extra'] = scraper_utils.cleanse_title(result['title'])
                    if video.video_type == VIDEO_TYPES.MOVIE:
                        meta = scraper_utils.parse_movie_link(hoster['extra'])
                    else:
                        meta = scraper_utils.parse_episode_link(hoster['extra'])
                    if 'format' in meta: hoster['format'] = meta['format']
                    
                    hosters.append(hoster)
                    seen_urls.add(stream_url)

        return hosters
Ejemplo n.º 7
0
    def get_sources(self, video):
        hosters = []
        source_url = self.get_url(video)
        if not source_url or source_url == FORCE_NO_MATCH: return hosters
        url = scraper_utils.urljoin(self.base_url, source_url)
        html = self._http_get(url, cache_limit=.5)

        pattern = 'href="[^"]+gtfo=([^&"]+)[^>]+>([^<]+)'
        for match in re.finditer(pattern, html, re.DOTALL | re.I):
            url, link_name = match.groups()
            url = url.decode('base-64')
            host = urlparse.urlsplit(url).hostname
            match = re.search('Part\s+(\d+)', link_name)
            if match:
                if match.group(1) == '2':
                    del hosters[-1]  # remove Part 1 previous link added
                continue

            source = {
                'multi-part': False,
                'url': url,
                'host': host,
                'class': self,
                'quality': scraper_utils.get_quality(video, host,
                                                     QUALITIES.HIGH),
                'views': None,
                'rating': None,
                'direct': False
            }
            hosters.append(source)

        return hosters
    def get_sources(self, video):
        source_url = self.get_url(video)
        hosters = []
        if not source_url or source_url == FORCE_NO_MATCH: return hosters
        page_url = scraper_utils.urljoin(self.base_url, source_url)
        html = self._http_get(page_url, cache_limit=.5)
        for _attrs, row in dom_parser2.parse_dom(html, 'tr', {'id': 'linktr'}):
            redirect = dom_parser2.parse_dom(row, 'span', req='id')
            link = dom_parser2.parse_dom(row, 'a', req='href')
            if link and link[0].attrs['href'].startswith('http'):
                stream_url = link[0].attrs['href']
            elif redirect:
                stream_url = redirect[0].attrs['id']
            else:
                stream_url = ''

            if stream_url.startswith('http'):
                host = urlparse.urlparse(stream_url).hostname
            else:
                host = dom_parser2.parse_dom(row, 'h9')
                host = host[0].content if host else ''
                
            if stream_url and host:
                quality = scraper_utils.get_quality(video, host, QUALITIES.HIGH)
                hoster = {'multi-part': False, 'host': host, 'class': self, 'quality': quality, 'views': None, 'rating': None, 'url': stream_url, 'direct': False}
                hosters.append(hoster)
            
        return hosters
Ejemplo n.º 9
0
    def get_sources(self, video):
        hosters = []
        source_url = self.get_url(video)
        if not source_url or source_url == FORCE_NO_MATCH: return hosters
        page_url = scraper_utils.urljoin(self.base_url, source_url)
        html = self._http_get(page_url, cache_limit=.25)
        for _attrs, link in dom_parser2.parse_dom(html, 'div', {'class': 'ldr-item'}):
            stream_url = dom_parser2.parse_dom(link, 'a', req='data-actuallink')
            
            try:
                watched = dom_parser2.parse_dom(link, 'div', {'class': 'click-count'})
                match = re.search(' (\d+) ', watched[0].content)
                views = match.group(1)
            except:
                views = None
                    
            try:
                score = dom_parser2.parse_dom(link, 'div', {'class': 'point'})
                score = int(score[0].content)
                rating = score * 10 if score else None
            except:
                rating = None
            
            if stream_url:
                stream_url = stream_url[0].attrs['data-actuallink'].strip()
                host = urlparse.urlparse(stream_url).hostname
                quality = scraper_utils.get_quality(video, host, QUALITIES.HIGH)
                hoster = {'multi-part': False, 'host': host, 'class': self, 'quality': quality, 'views': views, 'rating': rating, 'url': stream_url, 'direct': False}
                hosters.append(hoster)

        return hosters
Ejemplo n.º 10
0
    def get_sources(self, video):
        source_url = self.get_url(video)
        hosters = []
        if not source_url or source_url == FORCE_NO_MATCH: return hosters
        url = scraper_utils.urljoin(self.base_url, source_url)
        html = self._http_get(url, cache_limit=.5)

        match = re.search('Views?\s*:\s*(\d+)', html, re.I)
        if match:
            views = match.group(1)
        else:
            views = None

        pattern = 'href="[^"]+/rd\.html\?url=([^"]+)'
        for match in re.finditer(pattern, html):
            url = match.group(1)
            host = urlparse.urlsplit(url).hostname
            hoster = {
                'multi-part': False,
                'host': host,
                'url': url,
                'class': self,
                'rating': None,
                'views': views,
                'quality': scraper_utils.get_quality(video, host,
                                                     QUALITIES.HIGH),
                'direct': False
            }
            hosters.append(hoster)

        return hosters
Ejemplo n.º 11
0
    def get_sources(self, video):
        source_url = self.get_url(video)
        hosters = []
        if source_url and source_url != FORCE_NO_MATCH:
            url = urlparse.urljoin(self.base_url, source_url)
            html = self._http_get(url, cache_limit=.5)

            for match in re.finditer(
                    '<a[^>]+href="([^"]+)[^>]+>(Version \d+)<', html):
                url, version = match.groups()
                host = urlparse.urlsplit(url).hostname.replace('embed.', '')
                hoster = {
                    'multi-part':
                    False,
                    'host':
                    host,
                    'class':
                    self,
                    'quality':
                    scraper_utils.get_quality(video, host, QUALITIES.HIGH),
                    'views':
                    None,
                    'rating':
                    None,
                    'url':
                    url,
                    'direct':
                    False
                }
                hoster['version'] = version
                hosters.append(hoster)

        return hosters
Ejemplo n.º 12
0
    def get_sources(self, video):
        source_url = self.get_url(video)
        hosters = []
        if source_url and source_url != FORCE_NO_MATCH:
            url = urlparse.urljoin(self.base_url, source_url)
            html = self._http_get(url, cache_limit=.5)

            pattern = '<tr\s+id="link_(.*?)</tr>'
            for match in re.finditer(pattern, html, re.DOTALL):
                link = match.group(1)
                link_pattern = 'href="([^"]+)">\s*([^<]+).*?class="text">\s*([^<%]+).*?class="qualityCell[^>]*>\s*([^<]+)'
                link_match = re.search(link_pattern, link, re.DOTALL)
                if link_match:
                    url, host, rating, quality = link_match.groups()
                    host = host.strip()
                    quality = quality.upper().strip()
                    if rating == 'n/a': rating = None
                    url = url.replace('/show/', '/play/')
                    quality = QUALITY_MAP.get(quality, QUALITIES.MEDIUM)

                    hoster = {
                        'multi-part': False,
                        'url': url,
                        'host': host,
                        'class': self,
                        'quality':
                        scraper_utils.get_quality(video, host, quality),
                        'views': None,
                        'rating': rating,
                        'direct': False
                    }
                    hosters.append(hoster)

        return hosters
Ejemplo n.º 13
0
    def get_sources(self, video):
        hosters = []
        source_url = self.get_url(video)
        if not source_url or source_url == FORCE_NO_MATCH: return hosters
        url = scraper_utils.urljoin(self.base_url, source_url)
        html = self._http_get(url, cache_limit=.5)

        max_age = 0
        now = min_age = int(time.time())
        for _attrs, row in dom_parser2.parse_dom(html, 'tr',
                                                 {'id': re.compile('pt\d+')}):
            stream_url = dom_parser2.parse_dom(row,
                                               'a', {'class': 'spf-link'},
                                               req='href')
            host = dom_parser2.parse_dom(row, 'img', {'alt': ''}, req='src')
            data = dom_parser2.parse_dom(row, 'td')
            if stream_url and host:
                stream_url = stream_url[0].attrs['href']
                match = re.search('.*/(.*?)\.gif', host[0].attrs['src'])
                host = match.group(1) if match else ''

                age = dom_parser2.parse_dom(row, 'span', {'class': 'linkdate'})
                try:
                    age = age[0].content
                except:
                    try:
                        age = data[2].content
                    except:
                        age = 0

                try:
                    quality = data[3].content
                except:
                    quality = 'HDTV'

                age = self.__get_age(now, age)
                if age > max_age: max_age = age
                if age < min_age: min_age = age

                hoster = {
                    'multi-part': False,
                    'class': self,
                    'url': scraper_utils.pathify_url(stream_url),
                    'host': host,
                    'age': age,
                    'views': None,
                    'rating': None,
                    'direct': False
                }
                quality = QUALITY_MAP.get(quality.upper(), QUALITIES.HIGH)
                hoster['quality'] = scraper_utils.get_quality(
                    video, host, quality)
                hosters.append(hoster)

        unit = (max_age - min_age) / 100
        if unit > 0:
            for hoster in hosters:
                hoster['rating'] = (hoster['age'] - min_age) / unit
        return hosters
Ejemplo n.º 14
0
    def get_sources(self, video):
        source_url = self.get_url(video)
        hosters = []
        if source_url and source_url != FORCE_NO_MATCH:
            url = urlparse.urljoin(self.base_url, source_url)
            html = self._http_get(url, cache_limit=.5)

            container_pattern = r'<table[^>]+class="movie_version[ "][^>]*>(.*?)</table>'
            item_pattern = (
                r'quality_(?!sponsored|unknown|play)([^>]*)></span>.*?'
                r'url=([^&]+)&(?:amp;)?domain=([^&]+)&(?:amp;)?(.*?)'
                r'"version_veiws"> ([\d]+) views</')
            max_index = 0
            max_views = -1
            for container in re.finditer(container_pattern, html,
                                         re.DOTALL | re.IGNORECASE):
                for i, source in enumerate(
                        re.finditer(item_pattern, container.group(1),
                                    re.DOTALL)):
                    qual, url, host, parts, views = source.groups()

                    if host == 'ZnJhbWVndGZv':
                        continue  # filter out promo hosts

                    item = {
                        'host': host.decode('base-64'),
                        'url': url.decode('base-64'),
                        'class': self,
                        'direct': False
                    }
                    item['verified'] = source.group(0).find('star.gif') > -1
                    item['quality'] = scraper_utils.get_quality(
                        video, item['host'], QUALITY_MAP.get(qual.upper()))
                    item['views'] = int(views)
                    if item['views'] > max_views:
                        max_index = i
                        max_views = item['views']

                    if max_views > 0:
                        item['rating'] = item['views'] * 100 / max_views
                    else:
                        item['rating'] = None
                    pattern = r'<a href=".*?url=(.*?)&(?:amp;)?.*?".*?>(part \d*)</a>'
                    other_parts = re.findall(pattern, parts, re.DOTALL | re.I)
                    if other_parts:
                        item['multi-part'] = True
                        item['parts'] = [
                            part[0].decode('base-64') for part in other_parts
                        ]
                    else:
                        item['multi-part'] = False
                    hosters.append(item)

            if max_views > 0:
                for i in xrange(0, max_index):
                    hosters[i][
                        'rating'] = hosters[i]['views'] * 100 / max_views

        return hosters
Ejemplo n.º 15
0
    def get_sources(self, video):
        source_url = self.get_url(video)
        hosters = []
        if not source_url or source_url == FORCE_NO_MATCH: return hosters
        url = scraper_utils.urljoin(self.base_url, source_url)
        html = self._http_get(url, cache_limit=8)
        hosts = [
            r.content for r in dom_parser2.parse_dom(
                html, 'p', {'class': 'server_servername'})
        ]
        links = [
            r.content
            for r in dom_parser2.parse_dom(html, 'p', {'class': 'server_play'})
        ]
        for host, link_frag in zip(hosts, links):
            stream_url = dom_parser2.parse_dom(link_frag, 'a', req='href')
            if not stream_url: continue

            stream_url = stream_url[0].attrs['href']
            host = re.sub('^Server\s*', '', host, re.I)
            host = re.sub('\s*Link\s+\d+', '', host)
            if host.lower() == 'google':
                sources = self.__get_gvideo_links(stream_url)
            else:
                sources = [{'host': host, 'link': stream_url}]

            for source in sources:
                host = scraper_utils.get_direct_hostname(self, stream_url)
                if host == 'gvideo':
                    quality = scraper_utils.gv_get_quality(stream_url)
                    stream_url = source['link'] + scraper_utils.append_headers(
                        {'User-Agent': scraper_utils.get_ua()})
                    direct = True
                else:
                    stream_url = scraper_utils.pathify_url(source['link'])
                    host = HOST_SUB.get(source['host'].lower(), source['host'])
                    quality = scraper_utils.get_quality(
                        video, host, QUALITIES.HIGH)
                    direct = False

                hoster = {
                    'multi-part': False,
                    'url': stream_url,
                    'host': host,
                    'class': self,
                    'quality': quality,
                    'views': None,
                    'rating': None,
                    'direct': direct
                }
                hosters.append(hoster)

        return hosters
Ejemplo n.º 16
0
    def get_sources(self, video):
        hosters = []
        source_url = self.get_url(video)
        if not source_url or source_url == FORCE_NO_MATCH: return hosters
        url = scraper_utils.urljoin(self.base_url, source_url)
        html = self._http_get(url, cache_limit=.5)
        page_quality = QUALITIES.HD720 if video.video_type == VIDEO_TYPES.MOVIE else QUALITIES.HIGH
        for _attrs, fragment in dom_parser2.parse_dom(
                html, 'div', {'class': 'embed-responsive'}):
            iframe_url = dom_parser2.parse_dom(fragment,
                                               'iframe',
                                               req='data-src')
            if iframe_url:
                iframe_url = iframe_url[0].attrs['data-src']
                iframe_host = urlparse.urlparse(iframe_url).hostname
                if iframe_host in DIRECT_HOSTS:
                    sources = self.__parse_streams(iframe_url, url)
                else:
                    sources = {
                        iframe_url: {
                            'quality':
                            scraper_utils.get_quality(video, iframe_host,
                                                      page_quality),
                            'direct':
                            False
                        }
                    }

            for source in sources:
                quality = sources[source]['quality']
                direct = sources[source]['direct']
                if direct:
                    host = scraper_utils.get_direct_hostname(self, source)
                    stream_url = source + scraper_utils.append_headers(
                        {'User-Agent': scraper_utils.get_ua()})
                else:
                    host = urlparse.urlparse(source).hostname
                    stream_url = source

                hoster = {
                    'multi-part': False,
                    'url': stream_url,
                    'host': host,
                    'class': self,
                    'quality': quality,
                    'views': None,
                    'rating': None,
                    'direct': direct
                }
                hosters.append(hoster)

        return hosters
    def get_sources(self, video):
        source_url = self.get_url(video)
        hosters = []
        if not source_url or source_url == FORCE_NO_MATCH: return hosters
        url = scraper_utils.urljoin(self.base_url, source_url)
        html = self._http_get(url, cache_limit=.5)

        for match in re.finditer('<td>\s*<a\s+href="([^"]+)(?:[^>]+>){2}\s*(?:&nbsp;)*\s*([^<]+)', html):
            stream_url, host = match.groups()
            hoster = {'multi-part': False, 'host': host, 'class': self, 'quality': scraper_utils.get_quality(video, host, QUALITIES.HIGH), 'views': None, 'rating': None, 'url': stream_url, 'direct': False}
            hosters.append(hoster)

        return hosters
Ejemplo n.º 18
0
 def __get_post_links(self, html, video):
     sources = {}
     post = dom_parser.parse_dom(html, 'article', {'id': 'post-\d+'})
     if post:
         for fragment in dom_parser.parse_dom(post[0], 'h2'):
             for match in re.finditer('href="([^"]+)', fragment):
                 stream_url = match.group(1)
                 meta = scraper_utils.parse_episode_link(stream_url)
                 release_quality = scraper_utils.height_get_quality(meta['height'])
                 host = urlparse.urlparse(stream_url).hostname
                 quality = scraper_utils.get_quality(video, host, release_quality)
                 sources[stream_url] = quality
     return sources
Ejemplo n.º 19
0
    def get_sources(self, video):
        hosters = []
        source_url = self.get_url(video)
        if not source_url or source_url == FORCE_NO_MATCH: return hosters
        page_url = scraper_utils.urljoin(self.base_url, source_url)
        html = self._http_get(page_url, cache_limit=.5)
        page_quality = dom_parser2.parse_dom(html, 'dd', {'class': 'status'})
        if page_quality:
            page_quality = QUALITY_MAP.get(page_quality[0].content,
                                           QUALITIES.HIGH)
        else:
            page_quality = QUALITIES.HIGH

        if video.video_type == VIDEO_TYPES.EPISODE:
            fragment = dom_parser2.parse_dom(html, 'div',
                                             {'id': 'servers-list'})
            gk_html = fragment[0].content if fragment else ''
        else:
            gk_html = html

        link_url = scraper_utils.urljoin(self.base_url, LINK_URL)
        player_url = scraper_utils.urljoin(self.base_url, PLAYER_URL)
        for stream_url, quality in scraper_utils.get_gk_links(
                self, gk_html, page_url, page_quality, link_url,
                player_url).iteritems():
            host = scraper_utils.get_direct_hostname(self, stream_url)
            if host == 'gvideo':
                direct = True
                quality = quality
            else:
                host = urlparse.urlparse(stream_url).hostname
                quality = scraper_utils.get_quality(video, host, quality)
                direct = False

            if host is not None:
                stream_url += scraper_utils.append_headers(
                    {'User-Agent': scraper_utils.get_ua()})
                hoster = {
                    'multi-part': False,
                    'host': host,
                    'class': self,
                    'quality': quality,
                    'views': None,
                    'rating': None,
                    'url': stream_url,
                    'direct': direct
                }
                hosters.append(hoster)

        return hosters
Ejemplo n.º 20
0
 def get_sources(self, video):
     hosters = []
     source_url = self.get_url(video)
     if not source_url or source_url == FORCE_NO_MATCH: return hosters
     url = scraper_utils.urljoin(self.base_url, source_url)
     html = self._http_get(url, cache_limit=.5)
     pattern = '''tablemoviesindex2.*?href\s*=\s*['"]([^'"]+).*?&nbsp;([^<]+)'''
     for match in re.finditer(pattern, html):
         url, host = match.groups()
         if not url.startswith('/'): url = '/' + url
         quality = scraper_utils.get_quality(video, host, QUALITIES.HIGH)
         hoster = {'multi-part': False, 'host': host, 'class': self, 'quality': quality, 'views': None, 'rating': None, 'url': url, 'direct': False}
         hosters.append(hoster)
     return hosters
Ejemplo n.º 21
0
    def get_sources(self, video):
        source_url = self.get_url(video)
        hosters = []
        if source_url and source_url != FORCE_NO_MATCH:
            url = urlparse.urljoin(self.base_url, source_url)
            html = self._http_get(url, cache_limit=.5)

            quality = None
            match = re.search('Links\s+-\s+Quality\s*([^<]*)</h1>', html,
                              re.DOTALL | re.I)
            if match:
                quality = QUALITY_MAP.get(match.group(1).strip().upper())

            seen_links = {}
            for item in dom_parser.parse_dom(html, 'li',
                                             {'id': 'playing_button'}):
                stream_url = dom_parser.parse_dom(item, 'a', ret='href')
                if stream_url:
                    stream_url = stream_url[0]
                    match = re.search('url=([^&"]+)', stream_url)
                    if match:
                        stream_url = base64.b64decode(match.group(1))
                    else:
                        match = re.search('stream\.php\?([^"]+)', stream_url)
                        if match:
                            stream_url = base64.b64decode(match.group(1))
                            i = stream_url.rfind('&&')
                            if i > -1:
                                stream_url = stream_url[i + 2:]

                    if stream_url in seen_links: continue
                    seen_links[stream_url] = True
                    host = urlparse.urlparse(stream_url).hostname
                    hoster = {
                        'multi-part': False,
                        'host': host,
                        'class': self,
                        'url': stream_url,
                        'quality':
                        scraper_utils.get_quality(video, host, quality),
                        'rating': None,
                        'views': None,
                        'direct': False
                    }
                    hosters.append(hoster)
        return hosters
Ejemplo n.º 22
0
    def get_sources(self, video):
        hosters = []
        source_url = self.get_url(video)
        if not source_url or source_url == FORCE_NO_MATCH: return hosters
        url = scraper_utils.urljoin(self.base_url, source_url)
        entry = ''
        while True:
            html = self._http_get(url, cache_limit=.5)
            if not html:
                url = scraper_utils.urljoin(BASE_URL2, source_url)
                html = self._http_get(url, cache_limit=.5)

            entry = dom_parser2.parse_dom(html, 'div', {'class': 'entry'})
            if entry:
                entry = entry[0].content
                match = re.search('Watch it here\s*:.*?href="([^"]+)', entry,
                                  re.I)
                if not match: break
                url = match.group(1)
            else:
                entry = ''
                break

        for _attribs, tab in dom_parser2.parse_dom(entry, 'div',
                                                   {'class': 'postTabs_divs'}):
            match = dom_parser2.parse_dom(tab, 'iframe', req='src')
            if not match: continue
            link = match[0].attrs['src']
            host = urlparse.urlparse(link).hostname
            hoster = {
                'multi-part': False,
                'host': host,
                'class': self,
                'quality': scraper_utils.get_quality(video, host,
                                                     QUALITIES.HIGH),
                'views': None,
                'rating': None,
                'url': link,
                'direct': False
            }
            hosters.append(hoster)

        return hosters
Ejemplo n.º 23
0
    def get_sources(self, video):
        source_url = self.get_url(video)
        hosters = []
        if source_url and source_url != FORCE_NO_MATCH:
            url = urlparse.urljoin(self.base_url, source_url)
            html = self._http_get(url, cache_limit=.5)

            q_str = ''
            quality = None
            match = re.search('>Category.*?td_col">([^<]+)', html)
            if match:
                quality = QUALITY_MAP.get(match.group(1).upper(), None)
            else:
                match = re.search('>Release.*?td_col">([^<]+)', html)
                if match:
                    q_str = match.group(1).upper()

            pattern = "td_cols.+?href='(.+?)"
            for match in re.finditer(pattern, html):
                url = match.group(1)
                if re.search('\.rar(\.|$)', url):
                    continue

                hoster = {
                    'multi-part': False,
                    'class': self,
                    'views': None,
                    'url': url,
                    'rating': None,
                    'direct': False
                }
                hoster['host'] = urlparse.urlsplit(url).hostname
                if quality is None:
                    hoster['quality'] = scraper_utils.blog_get_quality(
                        video, q_str, hoster['host'])
                else:
                    hoster['quality'] = scraper_utils.get_quality(
                        video, hoster['host'], quality)
                hosters.append(hoster)

        return hosters
Ejemplo n.º 24
0
    def get_sources(self, video):
        source_url = self.get_url(video)
        hosters = []
        sources = {}
        if source_url and source_url != FORCE_NO_MATCH:
            url = urlparse.urljoin(self.base_url, source_url)
            html = self._http_get(url, cache_limit=.5)
            sources = self.__get_gk_links(html, url)
            if not sources:
                sources = self.__get_gk_links2(html)

            for source in sources:
                host = self._get_direct_hostname(source)
                if host == 'gvideo':
                    direct = True
                    quality = sources[source]
                    stream_url = source + scraper_utils.append_headers(
                        {'User-Agent': scraper_utils.get_ua()})
                else:
                    direct = False
                    stream_url = source
                    if self.base_url in source:
                        host = sources[source]
                        quality = scraper_utils.get_quality(
                            video, host, QUALITIES.HIGH)
                    else:
                        host = urlparse.urlparse(source).hostname
                        quality = sources[source]
                hoster = {
                    'multi-part': False,
                    'host': host,
                    'class': self,
                    'quality': quality,
                    'views': None,
                    'rating': None,
                    'url': stream_url,
                    'direct': direct
                }
                hosters.append(hoster)

        return hosters
Ejemplo n.º 25
0
    def get_sources(self, video):
        hosters = []
        source_url = self.get_url(video)
        if not source_url or source_url == FORCE_NO_MATCH: return hosters
        url = scraper_utils.urljoin(self.base_url, source_url)
        html = self._http_get(url, cache_limit=.5)
        if video.video_type == VIDEO_TYPES.EPISODE:
            html = self.__get_episode_fragment(html, video)
        for _attrs, item in dom_parser2.parse_dom(html, 'div', {'class': 'linkTr'}):
            stream_url = dom_parser2.parse_dom(item, 'div', {'class': 'linkHiddenUrl'})
            q_str = dom_parser2.parse_dom(item, 'div', {'class': 'linkQualityText'})
            if stream_url and q_str:
                stream_url = stream_url[0].content
                q_str = q_str[0].content
                host = urlparse.urlparse(stream_url).hostname
                base_quality = QUALITY_MAP.get(q_str, QUALITIES.HIGH)
                quality = scraper_utils.get_quality(video, host, base_quality)
                source = {'multi-part': False, 'url': stream_url, 'host': host, 'class': self, 'quality': quality, 'views': None, 'rating': None, 'direct': False}
                hosters.append(source)

        return hosters
 def get_sources(self, video):
     source_url = self.get_url(video)
     hosters = []
     if not source_url or source_url == FORCE_NO_MATCH: return hosters
     page_url = scraper_utils.urljoin(self.base_url, source_url)
     headers = {'Refer': self.base_url}
     html = self._http_get(page_url, headers=headers, cache_limit=.5)
     for _attrs, table in dom_parser2.parse_dom(html, 'table', {'class': 'W'}):
         for _attrs, row in dom_parser2.parse_dom(table, 'tr'):
             td = dom_parser2.parse_dom(row, 'td')
             stream_url = dom_parser2.parse_dom(row, 'a', req='href')
             if not td or not stream_url: continue
             
             host = td[0].content
             host = re.sub('<!--.*?-->', '', host)
             host = re.sub('<([^\s]+)[^>]*>.*?</\\1>', '', host)
             host = host.strip()
             stream_url = stream_url[0].attrs['href']
             quality = scraper_utils.get_quality(video, host, QUALITIES.HIGH)
             hoster = {'multi-part': False, 'host': host, 'class': self, 'quality': quality, 'views': None, 'rating': None, 'url': stream_url, 'direct': False}
             hosters.append(hoster)
     return hosters
Ejemplo n.º 27
0
    def get_sources(self, video):
        hosters = []
        source_url = self.get_url(video)
        if not source_url or source_url == FORCE_NO_MATCH: return hosters
        url = scraper_utils.urljoin(self.base_url, source_url)
        html = self._http_get(url, require_debrid=True, cache_limit=.5)
        fragment = dom_parser2.parse_dom(html, 'div', {'class': 'post-cont'})
        if not fragment: return hosters

        match = re.search('<p>\s*<strong>(.*?)<script', fragment[0].content,
                          re.DOTALL)
        if not match: return hosters

        for attrs, _content in dom_parser2.parse_dom(match.group(1),
                                                     'a',
                                                     req='href'):
            stream_url = attrs['href']
            if scraper_utils.excluded_link(stream_url): continue
            if video.video_type == VIDEO_TYPES.MOVIE:
                meta = scraper_utils.parse_movie_link(stream_url)
            else:
                meta = scraper_utils.parse_episode_link(stream_url)

            host = urlparse.urlparse(stream_url).hostname
            quality = scraper_utils.get_quality(
                video, host, scraper_utils.height_get_quality(meta['height']))
            hoster = {
                'multi-part': False,
                'host': host,
                'class': self,
                'views': None,
                'url': stream_url,
                'rating': None,
                'quality': quality,
                'direct': False
            }
            hosters.append(hoster)

        return hosters
Ejemplo n.º 28
0
    def get_sources(self, video):
        hosters = []
        source_url = self.get_url(video)
        if not source_url or source_url == FORCE_NO_MATCH: return hosters
        url = scraper_utils.urljoin(self.base_url, source_url)
        html = self._http_get(url, cache_limit=.5)

        for _attrs, item in dom_parser2.parse_dom(html, 'li'):
            label = dom_parser2.parse_dom(item, 'span', {'class': 'type'})
            value = dom_parser2.parse_dom(item, 'p', {'class': 'text'})
            if label and value and 'quality' in label[0].content.lower():
                q_str = value[0].content.upper()
                break
        else:
            q_str = ''

        fragment = dom_parser2.parse_dom(html, 'div', {'id': 'fstory-video'})
        if not fragment: return hosters

        for match in re.finditer('<iframe[^>]*src="([^"]+)',
                                 fragment[0].content, re.I):
            stream_url = match.group(1)
            host = urlparse.urlparse(stream_url).hostname
            quality = scraper_utils.get_quality(
                video, host, QUALITY_MAP.get(q_str, QUALITIES.HIGH))
            hoster = {
                'multi-part': False,
                'host': host,
                'class': self,
                'quality': quality,
                'views': None,
                'rating': None,
                'url': stream_url,
                'direct': False
            }
            hosters.append(hoster)

        return hosters
Ejemplo n.º 29
0
 def __get_mirror_links(self, html, video):
     sources = {}
     for attrs, _content in dom_parser2.parse_dom(html, 'img', req='src'):
         image = attrs['src']
         if image.endswith('/mirrors.png'):
             match = re.search('%s.*?<p>(.*?)</p>' % (image), html,
                               re.DOTALL)
             if match:
                 for attrs, _content in dom_parser2.parse_dom(
                         match.group(1), 'a', req='href'):
                     stream_url = attrs['href']
                     host = urlparse.urlparse(stream_url).hostname
                     meta = scraper_utils.parse_episode_link(stream_url)
                     base_quality = scraper_utils.height_get_quality(
                         meta['height'])
                     sources[stream_url] = {
                         'quality':
                         scraper_utils.get_quality(video, host,
                                                   base_quality),
                         'direct':
                         False
                     }
     return sources
    def get_sources(self, video):
        source_url = self.get_url(video)
        hosters = []
        if not source_url or source_url == FORCE_NO_MATCH: return hosters
        page_url = scraper_utils.urljoin(self.base_url, source_url)
        html = self._http_get(page_url, cache_limit=1)
        for _attrs, item in dom_parser2.parse_dom(html, 'a',
                                                  {'class': 'full-torrent1'}):
            stream_url = dom_parser2.parse_dom(item, 'span', req='onclick')
            host = dom_parser2.parse_dom(item, 'div',
                                         {'class': 'small_server'})
            match = re.search('Views:\s*(?:</[^>]*>)?\s*(\d+)', item, re.I)
            views = match.group(1) if match else None
            match = re.search('Size:\s*(?:</[^>]*>)?\s*(\d+)', item, re.I)
            size = int(match.group(1)) * 1024 * 1024 if match else None
            if not stream_url or not host: continue

            stream_url = stream_url[0].attrs['onclick']
            host = host[0].content.lower()
            host = host.replace('stream server: ', '')
            match = re.search("'(/redirect/[^']+)", stream_url)
            if match: stream_url = match.group(1)
            quality = scraper_utils.get_quality(video, host, QUALITIES.HIGH)
            hoster = {
                'multi-part': False,
                'host': host,
                'class': self,
                'quality': quality,
                'views': views,
                'rating': None,
                'url': stream_url,
                'direct': False
            }
            if size is not None:
                hoster['size'] = scraper_utils.format_size(size, 'B')
            hosters.append(hoster)
        return hosters