Changeset 39608


Ignore:
Timestamp:
Jan 2, 2017, 2:33:37 AM (3 years ago)
Author:
obi
Message:

add cloudtime py hoster

Location:
titan/mediathek/localhoster
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • titan/mediathek/localhoster/hoster.sh

    r39606 r39608  
    164164        $BIN $CMD/nowvideo.py $INPUT
    165165}
     166
     167divxstage()
     168{
     169        $BIN $CMD/divxstage.py $INPUT
     170}
     171
    166172
    167173if [ "$TYPE" == "get" ];then
     
    192198                streamcloud1) streamcloud $INPUT;;     
    193199                nowvideo) nowvideo $INPUT;;
     200                divxstage) divxstage $INPUT;;
     201                cloudtime) divxstage $INPUT;;
    194202        esac
    195203fi
  • titan/mediathek/localhoster/lib/common.py

    r39604 r39608  
    3535IE_USER_AGENT = 'Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; AS; rv:11.0) like Gecko'
    3636#FF_USER_AGENT = 'Mozilla/5.0 (Windows NT 6.3; rv:36.0) Gecko/20100101 Firefox/36.0'
    37 FF_USER_AGENT = 'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Maxthon/4.4.7.3000 Chrome/30.0.1599.101 Safari/537.36' 
     37FF_USER_AGENT = 'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Maxthon/4.4.7.3000 Chrome/30.0.1599.101 Safari/537.36'
    3838OPERA_USER_AGENT = 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.111 Safari/537.36 OPR/34.0.2036.50'
    3939IOS_USER_AGENT = 'Mozilla/5.0 (iPhone; CPU iPhone OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5376e Safari/8536.25'
  • titan/mediathek/localhoster/openload.py

    r38996 r39608  
    66import re
    77import lib.ol_gmu as ol_gmu
     8import lib.common as common
    89
    9 OL_SOURCE = 'https://offshoregit.com/tvaresolvers/ol_gmu.py'
     10#OL_SOURCE = 'https://offshoregit.com/tvaresolvers/ol_gmu.py'
    1011OL_PATH = ''
     12
     13API_BASE_URL = 'https://api.openload.co/1'
     14INFO_URL = API_BASE_URL + '/streaming/info'
     15GET_URL = API_BASE_URL + '/streaming/get?file={media_id}'
     16#OL_PATH = os.path.join(common.plugins_path, 'ol_gmu.py')
     17
    1118
    1219class OpenLoadResolver(object):
     
    3037            return False
    3138
     39    def i18n(string_id):
     40        try:
     41            return addon.getLocalizedString(strings.STRINGS[string_id]).encode('utf-8', 'ignore')
     42        except Exception as e:
     43#            log_utils.log('Failed String Lookup: %s (%s)' % (string_id, e))
     44            return string_id
     45
    3246    def get_ol_code(self):
    3347        try:
     
    3953                    f.write(new_py)
    4054        except Exception as e:
    41             common.log_utils.log_warning('Exception during openload code retrieve: %s' % e)
     55             print 'Exception during openload code retrieve:'
     56#            common.log_utils.log_warning('Exception during openload code retrieve: %s' % e)
    4257           
    4358    def get_media_url(self, host, media_id):
    44 #        common.log_utils.log('host: %s' % (host))
    45 #        common.log_utils.log('media_id: %s' % (media_id))
    46 #        common.log_utils.log('OL_PATH: %s' % (OL_PATH))
     59        video_url = ""
    4760        try:
    48 #            if self.get_setting('auto_update') == 'true':
    49 #                self.get_ol_code()
    50 #            with open(OL_PATH, 'r') as f:
    51 #                py_data = f.read()
    52 #            common.log_utils.log('py_data: %s' % (py_data))
    53 #            common.log_utils.log('ol_gmu hash: %s' % (hashlib.md5(py_data).hexdigest()))
    54 #            import ol_gmu
    55             web_url = self.get_url(host, media_id)
    56 #            common.log_utils.log('web_url: %s' % (web_url))
    57             print ol_gmu.get_media_url(web_url)
     61            self._auto_update(self.get_setting('url'), OL_PATH, self.get_setting('key'))
     62            reload(ol_gmu)
     63            return ol_gmu.get_media_url(self.get_url(host, media_id))  # @UndefinedVariable
    5864        except Exception as e:
    59 #            common.log_utils.log_debug('Exception during openload resolve parse: %s' % e)
    60             raise
     65#            common.log_utils.log_debug('Exception during openload resolve parse: %s' % (e))
     66            try:
     67                video_url = self.__check_auth(media_id)
     68                if not video_url:
     69                    video_url = self.__auth_ip(media_id)
     70            #except ResolverError:
     71            except Exception as e:
     72                print "raise"
     73               # raise
     74           
     75            if video_url:
     76                print video_url
    6177
    6278    def get_url(self, host, media_id):
    63         return 'http://openload.io/embed/%s' % media_id
     79        return 'http://openload.co/embed/%s' % (media_id)
    6480
    65     def get_settings_xml(cls):
    66         xml = super(cls, cls).get_settings_xml()
    67         xml.append('<setting id="%s_auto_update" type="bool" label="Automatically update resolver" default="true"/>' % (cls.__name__))
    68         return xml
     81    def __auth_ip(self, media_id):
     82        js_data = self.__get_json(INFO_URL)
     83        pair_url = js_data.get('result', {}).get('auth_url', '')
     84        if pair_url:
     85            pair_url = pair_url.replace('\/', '/')
     86            header = i18n('ol_auth_header')
     87            line1 = i18n('auth_required')
     88            line2 = i18n('visit_link')
     89            line3 = i18n('click_pair') % (pair_url)
     90            with common.kodi.CountdownDialog(header, line1, line2, line3) as cd:
     91                return cd.start(self.__check_auth, [media_id])
     92       
     93    def __check_auth(self, media_id):
     94        try:
     95            js_data = self.__get_json(GET_URL.format(media_id=media_id))
     96#        except ResolverError as e:
     97        except Exception as e:
     98            status, msg = e
     99            if status == 403:
     100                return
     101#            else:
     102#                raise ResolverError(msg)
     103       
     104        return js_data.get('result', {}).get('url')
     105   
     106    def __get_json(self, url):
     107        result = self.net.http_GET(url).content
     108        js_result = json.loads(result)
     109#        common.log_utils.log_debug(js_result)
     110#        if js_result['status'] != 200:
     111#            raise ResolverError(js_result['status'], js_result['msg'])
     112        return js_result
     113
    69114
    70115sys.stdout = OpenLoadResolver()
Note: See TracChangeset for help on using the changeset viewer.