def get_link(self, response, domain):
        movie = {
            'group': {},
            'episode': [],
            'links': [],
        }

        sources = re.search(r'"source":({.*?}})', response)
        if sources:
            sources = json.loads(sources.group(1), encoding='utf-8')
            if len(sources['medias']['levels']) > 0:
                for f in sources['medias']['levels']:
                    url = CryptoAES().decrypt(f['file'], f['key'])
                    movie['links'].append({
                        'link': url,
                        'title': 'Link %s' % f['label'],
                        'type': f['type'],
                        'resolve': False,
                        'originUrl': domain
                    })

        sources = re.search(r'"source":(\[.*?\])', response)
        if sources:
            sources = json.loads(sources.group(1), encoding='utf-8')
            for f in sources:
                url = CryptoAES().decrypt(f['link'], f['key'])
                if not Parser.parse_link(url, domain, movie['links']):
                    movie['links'].append({
                        'link': url,
                        'title': 'Link %s' % f['namesv'],
                        'type': f['typeplay'],
                        'resolve': False,
                        'originUrl': domain
                    })

        sources = re.search(r'"sourcebk":(\[.*?\])', response)
        if sources:
            sources = json.loads(sources.group(1), encoding='utf-8')
            if len(sources) > 0:
                for f in sources:
                    url = CryptoAES().decrypt(f['link'], f['key'])
                    movie['links'].append({
                        'link': url,
                        'title': 'Link %s' % f['namesv'],
                        'type': f['typeplay'],
                        'resolve': False,
                        'originUrl': domain
                    })

        return movie
Beispiel #2
0
def get_link(url):
    req = Request()
    url = url.replace('motphim.net', 'motphimzzz.com')

    parsed = urlparse(url)
    response = req.post("https://iapi.mpapis.xyz/cloud/",
                        params={'d': parse_qs(parsed.query)['d']},
                        headers={'origin': "https://motphimzzz.com"})
    url = CryptoAES().decrypt(
        json.loads(response).get('d'), 'motphimzzz.com45904818772018')
    return url, 'motphim'
Beispiel #3
0
 def extract_link(response, args):
     response = json.loads(response, encoding='utf-8')
     movie_links, originURL = args
     if len(response) > 0:
         for m in response:
             url = CryptoAES().decrypt(m['file'], m['key'])
             if 'http://' in url or 'https://' in url:
                 item = {
                     'link': url,
                     'title': 'Link %s' % m['label'],
                     'type': m['type'],
                     'resolve': False,
                     'originUrl': originURL
                 }
                 movie_links.append(item)
     else:
         raise Exception("Error")
    def parse_link(response, movie_links, response_headers):
        sources = json.loads(response)
        if 'link' in sources:
            if isinstance(sources['link'], list):
                for source in sources['link']:
                    if 'http' in source['link']:
                        movie_links.append((source['link'], source['label']))
                    else:
                        key = md5(response_headers.get('Expires')).hexdigest()
                        source['link'] = CryptoAES().decrypt(
                            source['link'], key)
                        movie_links.append((source['link'], source['label']))
            elif 'http' in sources['link']:
                movie_links.append(
                    (sources['link'], 'label' in sources and sources['label']
                     or '720p'))

        return movie_links
Beispiel #5
0
    def get_link(self, response, request, api_url, domain, originUrl):
        movie = {
            'group': {},
            'episode': [],
            'links': [],
        }

        datalink = re.search(r'var\sdataLink="(.*)"', response).group(1)
        eid = re.search(r'var\seId="(.*)"', response).group(1)
        vid = re.search(r'var\svId="(.*)"', response).group(1)
        slug = re.search(r'var\sslug="(.*)"', response).group(1)

        # get token
        csrf = re.search(r'<meta name="csrf-token" content="(.*)">',
                         response).group(1)

        response = request.post(api_url,
                                params={
                                    'x_dataLink': datalink,
                                    'x_subTitle': '',
                                    'x_eId': eid,
                                    'x_vId': vid,
                                    'x_slug': slug,
                                },
                                headers={
                                    'Origin': domain,
                                    'Referer': originUrl
                                })

        sources = json.loads(response, encoding='utf8')
        print sources
        return movie

        for f in sources.get('playlist'):
            url = CryptoAES().decrypt(f['file'], self.key)
            movie['links'].append({
                'link': url,
                'title': 'Link %s' % f['label'],
                'type': f['type'],
                'resolve': False,
                'originUrl': domain
            })

        return movie
Beispiel #6
0
    def get_link(self, response, domain, request, originURL):
        movie = {
            'group': {},
            'episode': [],
            'links': [],
        }

        self.originURL = originURL
        response = re.search(r'"source":(\[.*?\])', response)
        if response:
            response = json.loads(response.group(1), encoding='utf-8')
            if len(response) > 0:
                jobs = []
                for file in response:
                    if 'HDX' not in file['namesv']:
                        url = CryptoAES().decrypt(file['link'], file['key'])
                        if 'stream' in file['typeplay']:
                            jobs.append({
                                'url': url,
                                'parser': Parser.extract_link
                            })
                        else:
                            movie['links'].append({
                                'link':
                                url,
                                'title':
                                'Link %s' % file['namesv'],
                                'type':
                                file['namesv'],
                                'resolve':
                                False,
                                'originUrl':
                                originURL
                            })

                AsyncRequest(request=request, retry=50, thread=1).get(
                    jobs,
                    headers={
                        # 'origin': 'https://xomphimhay.com',
                        'referer': originURL
                    },
                    args=(movie['links'], originURL))
        return movie
    def parse_link(url, domain, links):
        if 'play.xemphimso.info/load-stream' in url:
            response = Request().get(url,
                                     headers={
                                         'origin': domain,
                                         'referer': domain
                                     })

            response = json.loads(response)
            for f in response:
                url = CryptoAES().decrypt(f.get('file'), f.get('key'))
                links.append({
                    'link': url,
                    'title': 'Link %s' % f.get('label'),
                    'type': f.get('label'),
                    'resolve': False,
                    'originUrl': domain
                })
            return True

        if 'drive.php' in url:
            response = Request().get("{}{}".format(domain, url),
                                     headers={
                                         'origin': domain,
                                         'referer': domain
                                     })

            js_sources = re.search(r'sources:\s(\[.*?\])', response)
            if js_sources:
                js_sources = json.loads(js_sources.group(1))
                for f in js_sources:
                    url = f.get('file')
                    links.append({
                        'link': url,
                        'title': 'Link %s' % f.get('label'),
                        'type': f.get('type'),
                        'resolve': False,
                        'originUrl': domain
                    })
            return True

        return False
Beispiel #8
0
    def get_link(self, response, domain):
        movie = {
            'group': {},
            'episode': [],
            'links': [],
        }

        response = re.search(r'"source":({.*?}})', response)
        if response:
            response = json.loads(response.group(1), encoding='utf-8')
            if len(response['medias']['levels']) > 0:
                for f in response['medias']['levels']:
                    url = CryptoAES().decrypt(f['file'], f['key'])
                    movie['links'].append({
                        'link': url,
                        'title': 'Link %s' % f['label'],
                        'type': f['type'],
                        'resolve': False,
                        'originUrl': domain
                    })

        return movie
    def extract_link(response, args=None):
        url = LinkExtractor.iframe(response)
        if url and 'short.icu' not in url:
            return url
        elif re.search(r'atob\(', response):
            cipher_text = re.search(r'atob\("(.*?)"\)', response).group(1)
            enc_data = json.loads(base64.b64decode(cipher_text))
            # cipher_text = 'Salted__{}{}'.format(
            #     codecs.decode(enc_data['s'], 'hex'),
            #     base64.b64decode(enc_data['ct'])
            # )

            cipher_text = b'Salted__' + bytearray.fromhex(
                enc_data['s']) + base64.b64decode(enc_data['ct'])
            cipher_text = base64.b64encode(cipher_text)
            url = CryptoAES().decrypt(cipher_text, 'caphedaklak').replace(
                '\\', '').replace('"', '')
            if url:
                return url
        else:
            helper.log(text(response))

        return None
Beispiel #10
0
    def get_link(self, response, url, request):
        helper.log(
            "***********************Get Movie Link*****************************"
        )
        movie = {
            'group': {},
            'episode': [],
            'links': [],
        }
        self.originURL = url
        url = self.get_token_url(response)
        response = Request().get(url)

        self.key = self.get_decrypt_key(response)

        self.key
        if not self.key:
            return movie

        jsonresponse = re.search("_responseJson='(.*)';", response).group(1)
        jsonresponse = json.loads(py2_decode(jsonresponse))

        # if jsonresponse['medias']:
        #     media = sorted(jsonresponse['medias'], key=lambda elem: elem['resolution'], reverse=True)
        #     for item in media:
        #         url = CryptoAES().decrypt(item['url'], bytes(self.key.encode('utf-8')))
        #         if not re.search('hls.phimmoi.net', url):
        #             movie['links'].append({
        #                 'link': url,
        #                 'title': 'Link %s' % item['resolution'],
        #                 'type': item['resolution'],
        #                 'resolve': False,
        #                 'originUrl': self.originURL
        #             })
        #         else:
        #             # hls.phimmoi.net
        #             movie['links'].append({
        #                 'link': url,
        #                 'title': 'Link hls',
        #                 'type': 'hls',
        #                 'resolve': False,
        #                 'originUrl': self.originURL
        #             })

        # if jsonresponse.get('embedUrls'):
        #     for item in jsonresponse.get('embedUrls'):
        #         url = self.get_url(CryptoAES().decrypt(item, bytes(self.key.encode('utf-8'))))
        #         if not re.search('hydrax', url):
        #             movie['links'].append({
        #                 'link': url,
        #                 'title': 'Link Unknow',
        #                 'type': 'mp4',
        #                 'resolve': False,
        #                 'originUrl': self.originURL
        #             })
        #         else:
        #             movie['links'].append({
        #                 'link': url,
        #                 'title': 'Link hydrax',
        #                 'type': 'hls',
        #                 'resolve': False,
        #                 'originUrl': self.originURL
        #             })

        if jsonresponse['thirdParty']:
            jobs = []
            self.key = "@@@3rd"
            for item in jsonresponse['thirdParty']:
                movie_url = self.get_url(CryptoAES().decrypt(
                    item.get('embed'), self.key))
                if 'hydrax.html' not in movie_url:
                    movie['links'].append({
                        'link':
                        movie_url,
                        'title':
                        'Link {}'.format(item.get('label', 'HD')),
                        'type':
                        item.get('type'),
                        'resolve':
                        False,
                        'originUrl':
                        self.originURL
                    })

        return movie
Beispiel #11
0
    def get_link(self, response, url):
        print(
            "***********************Get Movie Link*****************************"
        )
        movie = {
            'group': {},
            'episode': [],
            'links': [],
        }
        self.originURL = url
        url = self.get_token_url(response)
        response = Request().get(url)

        self.key = self.get_decrypt_key(response)
        if not self.key:
            return movie

        jsonresponse = re.search("_responseJson='(.*)';", response).group(1)
        jsonresponse = json.loads(jsonresponse.decode('utf-8'))

        if jsonresponse['medias']:
            media = sorted(jsonresponse['medias'],
                           key=lambda elem: elem['resolution'],
                           reverse=True)
            for item in media:
                url = CryptoAES().decrypt(item['url'],
                                          bytes(self.key.encode('utf-8')))
                if not re.search('hls.phimmoi.net', url):
                    movie['links'].append({
                        'link':
                        url,
                        'title':
                        'Link %s' % item['resolution'],
                        'type':
                        item['resolution'],
                        'resolve':
                        True
                    })
                else:
                    # hls.phimmoi.net
                    movie['links'].append({
                        'link': url,
                        'title': 'Link hls',
                        'type': 'hls',
                        'resolve': False,
                        'origin_url': self.originURL
                    })
        elif jsonresponse['embedUrls']:
            for item in jsonresponse['embedUrls']:
                url = CryptoAES().decrypt(item,
                                          bytes(self.key.encode('utf-8')))
                if not re.search('hydrax', url):
                    movie['links'].append({
                        'link': url,
                        'title': 'Link Unknow',
                        'type': 'mp4',
                        'resolve': False
                    })
                else:
                    movie['links'].append({
                        'link': url,
                        'title': 'Link hydrax',
                        'type': 'hls',
                        'resolve': False
                    })

        return movie
Beispiel #12
0
    def get_link(self, response, url, request):
        print("***********************Get Movie Link*****************************")
        movie = {
            'group': {},
            'episode': [],
            'links': [],
        }
        self.originURL = url
        url = self.get_token_url(response)
        response = Request().get(url)

        self.key = self.get_decrypt_key(response)
        if not self.key:
            return movie

        jsonresponse = re.search("_responseJson='(.*)';", response).group(1)
        jsonresponse = json.loads(jsonresponse.decode('utf-8'))

        # if jsonresponse['medias']:
        #     media = sorted(jsonresponse['medias'], key=lambda elem: elem['resolution'], reverse=True)
        #     for item in media:
        #         url = CryptoAES().decrypt(item['url'], bytes(self.key.encode('utf-8')))
        #         if not re.search('hls.phimmoi.net', url):
        #             movie['links'].append({
        #                 'link': url,
        #                 'title': 'Link %s' % item['resolution'],
        #                 'type': item['resolution'],
        #                 'resolve': False,
        #                 'originUrl': self.originURL
        #             })
        #         else:
        #             # hls.phimmoi.net
        #             movie['links'].append({
        #                 'link': url,
        #                 'title': 'Link hls',
        #                 'type': 'hls',
        #                 'resolve': False,
        #                 'originUrl': self.originURL
        #             })

        if jsonresponse.get('embedUrls'):
            for item in jsonresponse.get('embedUrls'):
                url = self.get_url(CryptoAES().decrypt(item, bytes(self.key.encode('utf-8'))))
                if not re.search('hydrax', url):
                    movie['links'].append({
                        'link': url,
                        'title': 'Link Unknow',
                        'type': 'mp4',
                        'resolve': False,
                        'originUrl': self.originURL
                    })
                else:
                    movie['links'].append({
                        'link': url,
                        'title': 'Link hydrax',
                        'type': 'hls',
                        'resolve': False,
                        'originUrl': self.originURL
                    })

        if jsonresponse['thirdParty']:
            jobs = []
            for item in jsonresponse['thirdParty']:
                if 'hydrax.html' not in item.get('embed'):
                    jobs.append({'url': item.get('embed'), 'headers': {
                        "Referer": self.originURL
                    }, 'parser': self.parse_thirdparty_link})

            AsyncRequest(request=request).get(jobs, args=movie['links'])

        return movie