Changeset 45112


Ignore:
Timestamp:
01/10/21 00:21:07 (10 months ago)
Author:
obi
Message:

tithek add upstream hoster

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

Legend:

Unmodified
Added
Removed
  • titan/mediathek/localhoster/lib/net.py

    r43827 r45112  
    862862           
    863863        self.content = html
    864    
    865    
    866     def get_headers(self):
    867         '''Returns a List of headers returned by the server.'''
    868         return self._response.info().headers
    869    
    870        
     864
     865    def get_headers(self, as_dict=False):
     866        """Returns headers returned by the server.
     867        If as_dict is True, headers are returned as a dictionary otherwise a list"""
     868        if as_dict:
     869            hdrs = {}
     870            for item in list(self._response.info().items()):
     871                if item[0].title() not in list(hdrs.keys()):
     872                    hdrs.update({item[0].title(): item[1]})
     873                else:
     874                    hdrs.update({item[0].title(): ','.join([hdrs[item[0].title()], item[1]])})
     875            # return dict([(item[0].title(), item[1]) for item in list(self._response.info().items())])
     876            return hdrs
     877        else:
     878            return self._response.info()._headers if six.PY3 else [(x.split(':')[0].strip(), x.split(':')[1].strip()) for x in self._response.info().headers]
     879
    871880    def get_url(self):
    872881        '''
  • titan/mediathek/localhoster/streamtape.py

    r45111 r45112  
    3434    domains = ['streamtape.com']
    3535    pattern = r'(?://|\.)(streamtape\.com)/(?:e|v)/([0-9a-zA-Z]+)'
    36     print "1111111111111"
    3736
    3837#    def __init__(self):
Note: See TracChangeset for help on using the changeset viewer.