Ignore:
Timestamp:
12/03/21 18:18:00 (6 months ago)
Author:
obi
Message:

tithek fix thevideo hoster

File:
1 edited

Legend:

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

    r44486 r45654  
    5656#        videoCode = self.getSearchGroups(response, r'''['"]video_code['"]\s*:\s*['"]([^'^"]+?)['"]''')[0]
    5757        videoCode = re.findall("video/mp4.*'(.*?)\\\\'.*;", response)
    58         print videoCode[0]
     58#        print videoCode[0]
     59
     60        sStreamUrl = 'https://thevideome.com/%s' % (videoCode[0])
     61        sUrl = self.redirectHoster(sStreamUrl)
     62        print sUrl
    5963
    6064    def getSearchGroups(self, data, pattern, grupsNum=1, ignoreCase=False):
     
    96100        return 'http://%s/embed-%s-640x360.html' % (host, media_id)
    97101
     102    def redirectHoster(self, url):
     103        try:
     104            from urllib2 import build_opener, HTTPError
     105        except ImportError:
     106            from urllib.error import HTTPError
     107            from urllib.request import build_opener
     108        opener = build_opener()
     109        opener.addheaders = [('Referer', url)]
     110        try:
     111            resp = opener.open(url)
     112            if url != resp.geturl():
     113                return resp.geturl()
     114            else:
     115                return url
     116        except HTTPError as e:
     117            if e.code == 403:
     118                if url != e.geturl():
     119                    return e.geturl()
     120            raise
     121
    98122sys.stdout = TheVideoResolver()
Note: See TracChangeset for help on using the changeset viewer.