Example #1
0
    def _get_data(self):
        # Kwik servers don't have direct link access you need to be referred
        # from somewhere, I will just use the url itself. We then
        # have to rebuild the url. Hopefully kwik doesn't block this too

        # Necessary
        self.url = self.url.replace(".cx/e/", ".cx/f/")
        self.headers.update({"referer": self.url})

        cookies = util.get_hcaptcha_cookies(self.url)

        if not cookies:
            resp = util.bypass_hcaptcha(self.url)
        else:
            resp = requests.get(self.url, cookies=cookies)

        title_re = re.compile(r'title>(.*)<')

        kwik_text = resp.text
        deobfuscated = None

        loops = 0
        while not deobfuscated and loops < 6:
            try:
                deobfuscated = helpers.soupify(
                    util.deobfuscate_packed_js(
                        re.search(r'<(script).*(var\s+_.*escape.*?)</\1>(?s)',
                                  kwik_text).group(2)))
            except (AttributeError, CalledProcessError) as e:
                if type(e) == AttributeError:
                    resp = util.bypass_hcaptcha(self.url)
                    kwik_text = resp.text

                if type(e) == CalledProcessError:
                    resp = requests.get(self.url, cookies=cookies)
            finally:
                cookies = resp.cookies
                title = title_re.search(kwik_text).group(1)
                loops += 1

        post_url = deobfuscated.form["action"]
        token = deobfuscated.input["value"]

        resp = helpers.post(post_url,
                            headers=self.headers,
                            params={"_token": token},
                            cookies=cookies,
                            allow_redirects=False)
        stream_url = resp.headers["Location"]

        logger.debug('Stream URL: %s' % stream_url)

        return {
            'stream_url': stream_url,
            'meta': {
                'title': title,
                'thumbnail': ''
            },
            'referer': None
        }
Example #2
0
    def _get_data(self):
        # Kwik servers don't have direct link access you need to be referred
        # from somewhere, I will just use the url itself. We then
        # have to rebuild the url. Hopefully kwik doesn't block this too
        eval_re = re.compile(r';(eval.*\))')
        stream_parts_re = re.compile(r'https:\/\/(.*?)\..*\/(\d+)\/(.*)\/.*token=(.*)&expires=([^\']+)')
        title_re = re.compile(r'title>(.*)<')

        kwik_text = helpers.get(self.url, referer=self.url).text
        obsfucated_js = eval_re.search(kwik_text).group(1)
        deobsfucated_js = util.deobfuscate_packed_js(obsfucated_js)

        title = title_re.search(kwik_text).group(1)
        cdn, digits, file, token, expires = stream_parts_re.search(deobsfucated_js).group(1, 2, 3, 4, 5)
        stream_url = f'https://{cdn}.nextstream.org/get/{token}/{expires}/mp4/{digits}/{file}/{title}'

        logger.debug('Stream URL: %s' % stream_url)
        return {
            'stream_url': stream_url,
            'meta': {
                'title': title,
                'thumbnail': ''
            },
            'referer': None
        }
Example #3
0
 def _get_data(self):
     eval_regex = r'eval\(.*\)'
     file_regex = r"file('|\"|):*.'(http.*?),"
     soup = helpers.soupify(helpers.get(self.url))
     packed_js = r'{}'.format(re.search(eval_regex,str(soup)).group())
     logger.debug('Packed javascript: {}'.format(packed_js))
     js = util.deobfuscate_packed_js(packed_js)
     file = re.search(file_regex,js).group(2)
     return {'stream_url': file}
Example #4
0
 def _get_data(self):
     soup = str(helpers.get(self.url).text)
     regex = r"eval\(function[\W\w]*?</script>"
     script = re.search(regex,soup).group().replace('</script>','')
     script = util.deobfuscate_packed_js(script)
     url = re.search(r'player\.src\("[^"]*',script).group().replace('player.src("','')
     return {
         'stream_url': url,
         'referer': self.url
     }
Example #5
0
 def _get_data(self):
     eval_regex = r'eval\(.*\)'
     wurl_regex = r'wurl.*?=.*?"(.*?)";'
     soup = helpers.get(self.url).text
     deobfuscated_js = util.deobfuscate_packed_js(re.search(eval_regex,soup).group())
     logger.debug('Deobfuscated JS: {}'.format(deobfuscated_js))
     url = re.search(wurl_regex,deobfuscated_js).group(1)
     logger.debug('Url: {}'.format(url))
     url = f'https:{url}' if url.startswith('//') else url
     return {'stream_url': url}
Example #6
0
    def _get_data(self):
        soup = str(helpers.get(self.url).text)
        if 'File was deleted' in soup:
            logger.warning('File not found (Most likely deleted)')
            return {'stream_url': ''}

        regex = r"eval\(function[\W\w]*?</script>"
        script = re.search(regex, soup).group().replace('</script>', '')
        script = util.deobfuscate_packed_js(script)
        url = ''
        if re.search(r'player\.src\("([^"]*)', script):
            url = re.search(r'player\.src\("([^"]*)', script).group(1)
        elif re.search(r'src:"([^"]*)', script):
            url = re.search(r'src:"([^"]*)', script).group(1)
        return {'stream_url': url, 'referer': self.url}
Example #7
0
    def _get_data(self):
        # Kwik servers don't have direct link access you need to be referred
        # from somewhere, I will just use the url itself. We then
        # have to rebuild the url. Hopefully kwik doesn't block this too

        #Necessary
        self.url = self.url.replace(".cx/e/", ".cx/f/")

        title_re = re.compile(r'title>(.*)<')

        resp = helpers.get(self.url, headers={"referer": self.url})
        kwik_text = resp.text
        cookies = resp.cookies

        title = title_re.search(kwik_text).group(1)
        deobfuscated = helpers.soupify(
            util.deobfuscate_packed_js(
                re.search(r'<(script).*(var\s+_.*escape.*?)</\1>(?s)',
                          kwik_text).group(2)))

        post_url = deobfuscated.form["action"]
        token = deobfuscated.input["value"]

        resp = helpers.post(post_url,
                            headers={"referer": self.url},
                            params={"_token": token},
                            cookies=cookies,
                            allow_redirects=False)
        stream_url = resp.headers["Location"]

        logger.debug('Stream URL: %s' % stream_url)
        return {
            'stream_url': stream_url,
            'meta': {
                'title': title,
                'thumbnail': ''
            },
            'referer': None
        }
Example #8
0
    def _get_data(self):
        eval_regex = r'eval\(.*\)'
        wurl_regex = r'wurl.*?=.*?"(.*?)";'
        # Group 2 is url
        # Allows redirects
        redirect_regex = r"\s*window\.location\s*=\s*('|\")(.*?)('|\")"
        # allow_redirects=True doesn't seem to be working
        soup = helpers.get(self.url, allow_redirects=True).text
        redirect = re.search(redirect_regex, soup)

        if redirect:
            url = 'https://mixdrop.to' + redirect.group(2)
            soup = helpers.get(url).text

        if 'WE ARE SORRY' in soup:
            return ''

        deobfuscated_js = util.deobfuscate_packed_js(
            re.search(eval_regex, soup).group())
        logger.debug('Deobfuscated JS: {}'.format(deobfuscated_js))
        url = re.search(wurl_regex, deobfuscated_js).group(1)
        logger.debug('Url: {}'.format(url))
        url = f'https:{url}' if url.startswith('//') else url
        return {'stream_url': url}