Ignore:
Timestamp:
12/03/21 13:00:22 (7 months ago)
Author:
obi
Message:

tithek fix streamtape

File:
1 edited

Legend:

Unmodified
Added
Removed
  • titan/mediathek/localhoster/streamtape.py

    r45112 r45650  
    3232class StreamTapeResolver(object):
    3333    name = "streamtape"
    34     domains = ['streamtape.com']
    35     pattern = r'(?://|\.)(streamtape\.com)/(?:e|v)/([0-9a-zA-Z]+)'
     34    domains = ['streamtape.com', 'strtape.cloud', 'streamtape.net', 'streamta.pe', 'streamtape.site', 'strcloud.link']
     35    pattern = r'(?://|\.)(str(?:eam)?(?:tap?e?|cloud)\.(?:com|cloud|net|pe|site|link))/(?:e|v)/([0-9a-zA-Z]+)'
    3636
    3737#    def __init__(self):
     
    5757        headers = {'User-Agent': common.FF_USER_AGENT,
    5858                   'Referer': 'https://{0}/'.format(host)}
    59         r = self.net.http_GET(web_url, headers=headers)
    60         src = re.search(r'''ById\('vi.+?=\s*["']([^"']+)['"].+?["']([^"']+)''', r.content)
     59        try:
     60            r = self.net.http_GET(web_url, headers=headers).content
     61        except urllib_error.HTTPError:
     62#            raise ResolverError('Video deleted or removed.')
     63            print 'errormsg=Video deleted or removed.'
     64            return
     65        src = re.findall(r'''ById\('.+?=\s*(["']//[^;<]+)''', r)
    6166        if src:
    62             src_url = 'https:{0}{1}&stream=1'.format(src.group(1), src.group(2))
     67            src_url = ''
     68            parts = src[-1].replace("'", '"').split('+')
     69            for part in parts:
     70                p1 = re.findall(r'"([^"]*)', part)[0]
     71                p2 = 0
     72                if 'substring' in part:
     73                    subs = re.findall(r'substring\((\d+)', part)
     74                    for sub in subs:
     75                        p2 += int(sub)
     76                src_url += p1[p2:]
     77            src_url += '&stream=1'
     78            src_url = 'https:' + src_url if src_url.startswith('//') else src_url
    6379            print helpers.get_redirect_url(src_url, headers) + helpers.append_headers(headers)
    6480#        raise ResolverError('Video cannot be located.')
    65 
    66 #    def get_url(self, host, media_id):
    67 #        return self._default_get_url(host, media_id, template='https://{host}/e/{media_id}')
     81        else
     82            print 'errormsg=Video cannot be located.'
    6883
    6984    def get_url(self, host, media_id):
Note: See TracChangeset for help on using the changeset viewer.