コード例 #1
0
ファイル: userload.py プロジェクト: OnePlayHD/OneRepo
    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        blurl = 'https://{0}/api/assets/userload/js/form.framework.js'.format(
            host)
        headers = {'User-Agent': common.RAND_UA}
        html = self.net.http_GET(web_url, headers=headers).content
        html = helpers.get_packed_data(html)
        headers.update({'Referer': web_url})
        bl = self.net.http_GET(blurl, headers=headers).content
        if jsunhunt.detect(bl):
            bl = jsunhunt.unhunt(bl)
        b1 = re.search(r'url:\s*"([^"]+)', bl)
        b2 = re.search(r'data:\s*{([^}]+)', bl)
        if b1 and b2:
            bd = re.findall(r'"([^"]+)":\s*([^,\s]+)', b2.group(1))
            data = {}
            for key, var in bd:
                r = re.search(r'{0}\s*=\s*"([^"]+)'.format(var), html)
                if r:
                    data.update({key: r.group(1)})

            if data:
                api_url = 'https://{0}{1}'.format(host, b1.group(1))
                headers.update({
                    'X-Requested-With': 'XMLHttpRequest',
                    'Origin': 'https://{0}'.format(host)
                })
                stream_url = self.net.http_POST(api_url, data,
                                                headers=headers).content
                headers.pop('X-Requested-With')
                stream_url = helpers.get_redirect_url(stream_url, headers)
                return stream_url + helpers.append_headers(headers)

        raise ResolverError('File not found')
コード例 #2
0
    def get_media_url(self, host, media_id):
        if '$$' in media_id:
            media_id, referer = media_id.split('$$')
            referer = urllib_parse.urljoin(referer, '/')
        else:
            referer = False

        web_url = self.get_url(host, media_id)
        if not referer:
            referer = urllib_parse.urljoin(web_url, '/')

        headers = {'User-Agent': common.FF_USER_AGENT, 'Referer': referer}

        html = self.net.http_GET(web_url, headers=headers).content
        if 'Please Wait' in html:
            raise ResolverError('Please Wait Video Uploading.')

        html = helpers.get_packed_data(html)
        sources = re.findall(
            r"label':\s*'(?P<label>[^']+).+?file':\s*'(?P<url>[^']+)", html)
        if sources:
            source = helpers.pick_source(sorted(sources, reverse=True))
            if source.startswith('/'):
                source = urllib_parse.urljoin(web_url, source)
            return source + helpers.append_headers(headers)

        raise ResolverError('No playable video found.')
コード例 #3
0
    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        headers = {
            'User-Agent': common.RAND_UA,
            'Referer': 'https://{0}/'.format(host)
        }
        html = self.net.http_GET(web_url, headers=headers).content
        source = re.search(r"download_video.+?'o','([^']+)", html)
        if source:
            dl_url = 'https://{0}/dl?op=download_orig&id={1}&mode=o&hash={2}'.format(
                host, media_id, source.group(1))
            html2 = self.net.http_GET(dl_url, headers=headers).content
            r = re.search(r'btn_direct-download"\s*href="([^"]+)', html2)
            if r:
                return r.group(1) + helpers.append_headers(headers)

        pdata = helpers.get_packed_data(html)
        if pdata:
            html = pdata
        sources = helpers.scrape_sources(
            html,
            patterns=[r'''{\s*file:\s*"(?P<url>[^"]+)"\s*}'''],
            generic_patterns=False)
        if sources:
            return helpers.pick_source(sources) + helpers.append_headers(
                headers)

        raise ResolverError('Video not found')
コード例 #4
0
    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        headers = {'User-Agent': common.CHROME_USER_AGENT}
        html = self.net.http_GET(web_url, headers=headers).content
        headers.update({'Referer': web_url})

        if 'sorry' in html:
            raise ResolverError("Video Deleted")

        r = re.search(r"redirect_vid\('([^']+)','([^']+)','([^']+)'", html)
        if r:
            surl = 'https://{0}/dl?op=download_orig&id={1}&mode={2}&hash={3}'.format(
                host, r.group(1), r.group(2), r.group(3)
            )
            dhtml = self.net.http_GET(surl, headers=headers).content
            s = re.search('href="([^"]+)">Direct', dhtml)
            if s:
                return s.group(1) + helpers.append_headers(headers)

        html += helpers.get_packed_data(html)
        sources = helpers.scrape_sources(html,
                                         patterns=[r'''sources:\s*\[(?:{file:)?\s*"(?P<url>[^"]+)'''],
                                         generic_patterns=False)
        if sources:
            return helpers.pick_source(sources) + helpers.append_headers(headers)

        raise ResolverError("Video not found")
コード例 #5
0
    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        headers = {'User-Agent': common.RAND_UA}
        html = self.net.http_GET(web_url, headers=headers).content
        html = helpers.get_packed_data(html)
        r = re.search(
            r"op:\s*'([^']+)',\s*file_code:\s*'([^']+)',\s*hash:\s*'([^']+)'",
            html)
        if r:
            url = 'https://playtube.ws/dl'
            data = {
                'op': r.group(1),
                'file_code': r.group(2),
                'hash': r.group(3)
            }
            headers.update({'Referer': url[:-2], 'Origin': url[:-3]})

            vfile = seed = None
            tries = 0
            while tries < 3 and vfile is None and seed is None:
                resp = self.net.http_POST(url, form_data=data,
                                          headers=headers).content
                resp = json.loads(resp)[0]
                vfile = resp.get('file')
                seed = resp.get('seed')
                tries += 1
            source = helpers.tear_decode(vfile, seed)
            if source:
                return source + helpers.append_headers(headers)
        raise ResolverError('File not found')
コード例 #6
0
 def get_media_url(self, host, media_id):
     web_url = self.get_url(host, media_id)
     headers = {'User-Agent': common.FF_USER_AGENT, 'Referer': web_url}
     html = self.net.http_GET(web_url, headers=headers).content
     html = helpers.get_packed_data(html)
     source = re.search(',"(http.*?mp4)"', html, re.I)
     if source:
         return source.group(1) + helpers.append_headers(headers)
     raise ResolverError('Video not found')
コード例 #7
0
    def get_media_url(self, host, media_id):
        embeds = [
            'http://bestarticles.me/', 'http://tellygossips.net/',
            'http://tvarticles.org/'
        ]
        web_url = self.get_url(host, media_id)
        headers = {
            'User-Agent': common.FF_USER_AGENT,
            'Referer': random.choice(embeds)
        }

        html = self.net.http_GET(web_url, headers=headers).content

        if 'Not Found' in html:
            raise ResolverError('File Removed')

        if 'Video is processing' in html:
            raise ResolverError('File still being processed')

        html += helpers.get_packed_data(html)
        packed = re.search(r"JuicyCodes\.Run\((.+?)\)", html, re.I)
        if packed:
            from base64 import b64decode
            packed = packed.group(1).replace('"', '').replace('+', '')
            packed = b64decode(packed.encode('ascii'))
            html += '%s</script>' % packed.decode('latin-1').strip()

        source = helpers.scrape_sources(
            html,
            patterns=[r'''"file":\s*"(?P<url>[^"]+\.(?:m3u8|mp4|txt))"'''])
        if source:
            headers.update({'Referer': web_url, 'Accept': '*/*'})
            vsrv = re.search(r'//(\d+)/', source[0][1])
            if vsrv:
                source = re.sub(r"//\d+/", "//{0}/".format(host),
                                source[0][1]) + '?s={0}&d='.format(
                                    vsrv.group(1))
                disk = re.findall(r'videoDisk":\s*"([^"]+)', html)
                if disk:
                    disk = base64.b64encode(
                        disk[0].encode('utf-8')).decode('utf-8')
                    source += disk
            else:
                source = source[0][1]
            html = self.net.http_GET(source, headers=headers).content
            sources = re.findall(r'RESOLUTION=\d+x(\d+)\n([^\n]+)', html)
            src = helpers.pick_source(helpers.sort_sources_list(sources))
            if not src.startswith('http'):
                src = re.sub(source.split('/')[-1], src, source)
            return src + helpers.append_headers(headers)

        raise ResolverError('Video not found')
コード例 #8
0
    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        headers = {'User-Agent': common.FF_USER_AGENT}
        html = self.net.http_GET(web_url, headers=headers).content

        html += helpers.get_packed_data(html)
        sources = re.search(r'sources:\s*(\[[^]]+])', html)
        if sources:
            sources = json.loads(sources.group(1))
            sources = [(x.get('label'), x.get('file')) for x in sources]
            source = helpers.pick_source(sorted(sources, reverse=True))
            return source + helpers.append_headers(headers)

        raise ResolverError('No playable video found.')
コード例 #9
0
    def get_media_url(self, host, media_id):

        web_url = self.get_url(host, media_id)
        headers = {'User-Agent': common.CHROME_USER_AGENT}
        html = self.net.http_GET(web_url, headers=headers).content

        html += helpers.get_packed_data(html)
        sources = helpers.scrape_sources(html)

        if sources:
            headers.update({'Referer': web_url})
            return self._redirect_test(
                helpers.pick_source(sources)) + helpers.append_headers(headers)
        else:
            raise ResolverError("Video not found")
コード例 #10
0
ファイル: mixdrop.py プロジェクト: elchocolate/repotvchopo
    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        headers = {'Origin': 'https://{}'.format(host),
                   'Referer': 'https://{}/'.format(host),
                   'User-Agent': common.RAND_UA}
        html = self.net.http_GET(web_url, headers=headers).content

        if '(p,a,c,k,e,d)' in html:
            html = helpers.get_packed_data(html)
        r = re.search(r'(?:vsr|wurl|surl)[^=]*=\s*"([^"]+)', html)
        if r:
            headers = {'User-Agent': common.RAND_UA, 'Referer': web_url}
            return "https:" + r.group(1) + helpers.append_headers(headers)

        raise ResolverError("Video not found")
コード例 #11
0
    def get_media_url(self, host, media_id):

        web_url = self.get_url(host, media_id)
        headers = {'User-Agent': common.CHROME_USER_AGENT}
        html = self.net.http_GET(web_url, headers=headers).content

        if '<b>File not found, sorry!</b>' not in html:
            html += helpers.get_packed_data(html)
            sources = helpers.scrape_sources(html)

            if sources:
                headers.update({'Referer': web_url})
                vurl = helpers.pick_source(sources)
                vurl = re.sub('get[0-9a-zA-Z]{4,5}-', 'getlink-', vurl)
                return helpers.get_redirect_url(vurl, headers) + helpers.append_headers(headers)

        raise ResolverError('Video not found or removed')
コード例 #12
0
    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        headers = {'User-Agent': common.FF_USER_AGENT}
        r = self.net.http_GET(web_url, headers=headers)
        cookie = ''
        for item in r.get_headers(as_dict=True)['Set-Cookie'].split('GMT,'):
            cookie += item.split('path')[0]
        headers.update({'Cookie': cookie + 'sugamun=1; invn=1; pfm=1'})

        html = self.net.http_GET(web_url, headers=headers).content
        html += helpers.get_packed_data(html)
        source = re.search(r'''file:\s*["'](?P<url>http[^"']+)["']''', html)
        headers.pop('Cookie')
        if source:
            return source.group(1) + helpers.append_headers(headers)

        raise ResolverError('Video not found')
コード例 #13
0
    def get_media_url(self, host, media_id):

        web_url = self.get_url(host, media_id)
        headers = {'User-Agent': common.CHROME_USER_AGENT}
        html = self.net.http_GET(web_url, headers=headers).content

        if '<b>File not found, sorry!</b>' not in html:
            html += helpers.get_packed_data(html)
            v = re.search(r"player\s*=\s*.*?'([^']+)", html)
            if v:
                vurl = re.search(
                    r'''{0}".+?src:\s*'([^']+)'''.format(v.group(1)), html)
                if vurl:
                    return helpers.get_redirect_url(
                        vurl.group(1),
                        headers) + helpers.append_headers(headers)

        raise ResolverError('Video not found or removed')
コード例 #14
0
    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        headers = {'User-Agent': common.RAND_UA}
        html = self.net.http_GET(web_url, headers=headers).content
        video_id = re.search(r"""playvideo\.php\?id=(\d+)""", html)
        if video_id:
            video_url = 'http://%s/jwplayer/playvideo.php?id=%s' % (
                host, video_id.group(1))
            headers.update({'Referer': web_url})
            _html = self.net.http_GET(video_url, headers=headers).content
            _html = helpers.get_packed_data(_html)
            sources = helpers.scrape_sources(
                _html, patterns=[r'''file:\s*["'](?P<url>http[^"']+)'''])
            if sources:
                return helpers.pick_source(sources) + helpers.append_headers(
                    headers)

        raise ResolverError('File not found')
コード例 #15
0
    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        headers = {'User-Agent': common.RAND_UA}
        html = self.net.http_GET(web_url, headers=headers).content
        if 'p,a,c,k,e' in html:
            html = helpers.get_packed_data(html)

        _srcs = re.search(r'sources\s*:\s*\[(.+?)\]', html)
        if _srcs:
            sources = helpers.scrape_sources(
                _srcs.group(1),
                patterns=['''["'](?P<url>http[^"']+)'''],
                result_blacklist=['.m3u8'])
            if sources:
                headers.update({'Referer': web_url})
                return helpers.pick_source(sources) + helpers.append_headers(
                    headers)

        raise ResolverError('File not found')
コード例 #16
0
    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        headers = {'User-Agent': common.RAND_UA}
        html = self.net.http_GET(web_url, headers=headers).content
        html = helpers.get_packed_data(html)
        r1 = re.search(r'cdbadffabaac\s*=\s*"([^"]+)', html)
        r2 = re.search(r'fcaecbefcaec\s*=\s*"([^"]+)', html)
        if r1 and r2:
            api_url = 'https://{0}/api/dline/'.format(host)
            data = {'hawk': r1.group(1), 'eye': r2.group(1)}
            headers.update({
                'X-Requested-With': 'XMLHttpRequest',
                'Origin': 'https://{0}'.format(host),
                'Referer': web_url
            })
            stream_url = self.net.http_POST(api_url, data,
                                            headers=headers).content
            headers.pop('X-Requested-With')
            stream_url = helpers.get_redirect_url(stream_url, headers)
            return stream_url + helpers.append_headers(headers)

        raise ResolverError('File not found')