Пример #1
0
    def get_link(self, response, movie_url):
        movie = {
            'group': {},
            'episode': [],
            'links': [],
        }

        sources = re.search(r'(eval\(function\(p,a,c,k,e,d\).*?)</script>', response)
        if sources:
            sources = sources.group(1)
            sources = Packer().unpack(sources)

            sources = re.search('sources:(.*?]),', sources)
            sources = re.sub(r'(?<={|,)([a-zA-Z][a-zA-Z0-9]*)(?=:)', r'"\1"', sources.group(1))
            sources = json.loads(sources)
            score = {'sd': 1, 'hd': 2, '360p': 1, '480p': 2, '720p': 3, '1080p': 3}
            if len(sources) > 1:
                try:
                    sources = sorted(sources, key=lambda elem: elem['label'].lower() in score and score[
                        elem['label'].lower()] or 3, reverse=True)
                except:
                    pass
            for source in sources:
                movie['links'].append({
                    'link': source['file'].replace('\\', ''),
                    'title': 'Link %s' % source['type'].encode('utf-8'),
                    'type': source['type'].encode('utf-8'),
                    'originUrl': movie_url,
                    'resolve': False
                })

        sources = re.search(r'sources:\s?(\[.*?\]),', response)
        if sources:
            sources = sources.group(1)
            sources = json.loads(sources)
            try:
                sources = sorted(sources, key=lambda elem: int(elem['label'][0:-1]), reverse=True)
            except:
                pass
            for source in sources:
                movie['links'].append({
                    'link': source['file'].replace('\\', ''),
                    'title': 'Link %s' % source['label'].encode('utf-8'),
                    'type': source['type'].encode('utf-8'),
                    'originUrl': movie_url,
                    'resolve': False
                })

        sources = re.search(r'data-lazy-src="(.*?)"', response)
        if sources:
            source = sources.group(1)
            movie['links'].append({
                'link': source,
                'title': 'Link Unknow',
                'type': 'Unknow',
                'originUrl': movie_url,
                'resolve': False
            })

        return movie
Пример #2
0
def get_link(url):
    response = Request().get(url)
    enc = re.search(r'(eval\(function\(p,a,c,k,e,d\).*)\s+?', response)

    if enc:
        sources = enc.group(1)
        sources = Packer().unpack(sources)
    else:
        sources = response

    sources = re.search(r'sources:\s?(.*?\]),', sources)
    try:
        sources = re.sub(r'(?<={|,)([a-zA-Z][a-zA-Z0-9]*)(?=:)', r'"\1"',
                         sources.group(1))
    except:
        pass

    sources = json.loads(sources)
    for source in sources:
        if 'label' in source and '720' in source['label']:
            return source['file'], 'mp4'

    if len(sources) > 0 and 'file' in sources[0]:
        return sources[0]['file'], 'hls4'

    return url, 'mp4'
Пример #3
0
def get_link(url):
    response = Request().get(url)
    enc = re.search(r'(eval\(function\(p,a,c,k,e,d\).*)\s+?</script>',
                    response)
    enc2 = re.search(r'sources:\s?(\[.*?\]),', response)
    found = False

    print "Apply VUVIPHIM parser"

    if enc:
        sources = enc.group(1)
        sources = Packer().unpack(sources)
        sources = re.search(r'sources:\s?(.*?\]),', sources)
        found = True

    elif enc2:
        sources = enc2.group(1)
        found = True

    if found:
        try:
            sources = re.sub(r'(?<={|,)([a-zA-Z][a-zA-Z0-9]*)(?=:)', r'"\1"',
                             sources.group(1))
        except:
            pass
        sources = json.loads(sources)

        print sources
        score = {'sd': 1, 'hd': 2, '360p': 1, '480p': 2, '720p': 3, '1080p': 3}
        if len(sources) > 0:
            try:
                sources = sorted(sources,
                                 key=lambda elem: elem['label'].lower() in
                                 score and score[elem['label'].lower()] or 3,
                                 reverse=True)
            except:
                pass

            if len(sources) > 1:
                listitems = [
                    "Link %s (%s)" % (i["label"], i["file"]) for i in sources
                ]
                index = helper.create_select_dialog(listitems)
                if index == -1:
                    return None, 'mp4'
                else:
                    return sources[index][
                        'file'] + '|referer=' + urllib.quote_plus(
                            url), sources[index]['type']
            else:
                return sources[0]['file'] + '|referer=' + urllib.quote_plus(
                    url), sources[0]['type']

    return url, 'vuviphim'
Пример #4
0
def get_link(url, media):
    response = Request().get(url)
    enc = re.search(r'(eval\(function\(p,a,c,k,e,d\).*)\s+?', response)

    if enc:
        sources = enc.group(1)
        sources = Packer().unpack(sources)
    else:
        sources = response

    source = re.search(r'wurl="(.*?)";', sources).group(1)
    if 'http' not in source:
        source = 'https:{}'.format(source)

    return source
Пример #5
0
    def get_link(self, response):
        movie = {
            'group': {},
            'episode': [],
            'links': [],
        }

        sources = re.search('(eval\(function\(p,a,c,k,e,d\).*)</script>', response)
        if sources:
            sources = sources.group(1)
            sources = Packer().unpack(sources)
            sources = re.search('sources:(.*?]),', sources)
            sources = re.sub(r'(?<={|,)([a-zA-Z][a-zA-Z0-9]*)(?=:)', r'"\1"', sources.group(1))
            sources = json.loads(sources)
            score = {'sd': 1, 'hd': 2, '360p': 1, '480p': 2, '720p': 3, '1080p': 3}
            if len(sources) > 1:
                try:
                    sources = sorted(sources, key=lambda elem: elem['label'].lower() in score and score[elem['label'].lower()] or 3, reverse=True)
                except:
                    pass
            print(sources)
            for source in sources:
                movie['links'].append({
                    'link': source['file'].replace('\\', ''),
                    'title': 'Link %s' % source['type'].encode('utf-8'),
                    'type': source['type'].encode('utf-8'),
                    'resolve': False
                })

            return movie

        soup = BeautifulSoup(response, "html.parser")
        source = soup.select_one("div#media > iframe")
        if source:
            source = source.get('data-lazy-src').strip()
            movie['links'].append({
                'link': source,
                'title': 'Link %s' % source,
                'type': 'Unknow',
                'resolve': False
            })

            return movie

        return movie
Пример #6
0
    def get_link(self, response, movie_url):
        movie = {
            'group': {},
            'episode': [],
            'links': [],
        }

        sources = re.search(r'(eval\(function\(p,a,c,k,e,d\).*)', response)
        if sources:
            sources = sources.group(1)
            sources = Packer().unpack(sources)
            sources = re.search('sources:(.*?]),', sources)

            sources = re.sub(r'(?<={|,)([a-zA-Z][a-zA-Z0-9]*)(?=:)', r'"\1"',
                             sources.group(1))
            try:
                sources = json.loads(sources)
            except:
                return movie
            score = {
                'sd': 1,
                'hd': 2,
                '360p': 1,
                '480p': 2,
                '720p': 3,
                '1080p': 3
            }
            if len(sources) > 1:
                try:
                    sources = sorted(
                        sources,
                        key=lambda elem: elem['label'].lower(
                        ) in score and score[elem['label'].lower()] or 3,
                        reverse=True)
                except:
                    pass
            for source in sources:
                movie['links'].append({
                    'link':
                    source['file'].replace('\\', ''),
                    'title':
                    'Link %s' % source['type'].encode('utf-8'),
                    'type':
                    source['type'].encode('utf-8'),
                    'originUrl':
                    movie_url,
                    'resolve':
                    False
                })

        sources = re.search(r'sources:\s?(\[.*?\]),', response)
        if sources:
            sources = helper.convert_js_2_json(sources.group(1))
            try:
                sources = sorted(sources,
                                 key=lambda elem: int(elem['label'][0:-1]),
                                 reverse=True)
            except:
                pass
            for source in sources:
                movie['links'].append({
                    'link':
                    source.get('file').replace('\\', ''),
                    'title':
                    'Link {}'.format(source.get('label')).encode('utf8'),
                    'type':
                    source.get('type').encode('utf-8'),
                    'originUrl':
                    movie_url,
                    'resolve':
                    False
                })

        # sources = re.search(r'data-lazy-src="(.*?)"', response)
        # if sources:
        #     source = sources.group(1)
        #     print source
        #
        #     movie['links'].append({
        #         'link': source,
        #         'title': 'Link Unknow',
        #         'type': 'Unknow',
        #         'originUrl': movie_url,
        #         'resolve': False
        #     })

        sources = re.search('<iframe.*src="(http.*?)" frameborder', response)
        if sources:
            source = sources.group(1)

            movie['links'].append({
                'link': source,
                'title': 'Link Unknow',
                'type': 'Unknow',
                'originUrl': movie_url,
                'resolve': False
            })
            # response = Request().get(sources.group(1))
            # return self.get_link(response, movie_url)

        return movie