Exemplo n.º 1
0
    def getSource(self,
                  url,
                  form_data,
                  referer='',
                  xml=False,
                  mobile=False,
                  ignoreCache=False,
                  demystify=False):
        if 'tvone.xml' in url:
            self.cachedSourcePath = url
            data = self.__getCachedSource()
            return data
        if '.r.de.a2ip.ru' in url:
            parsed_link = urlparse.urlsplit(url)
            parsed_link = parsed_link._replace(
                netloc=parsed_link.netloc.replace('.r.de.a2ip.ru', '').decode(
                    'rot13'))
            url = parsed_link.geturl()
        if 'calls/get/source' in url:
            ignoreCache = True

        if url == self.getLastUrl() and not ignoreCache:
            data = self.__getCachedSource()
        else:
            data = super(CachedWebRequest,
                         self).getSource(url, form_data, referer, xml, mobile,
                                         demystify)
            if data:
                # Cache url
                self.__setLastUrl(url)
                # Cache page
                setFileContent(self.cachedSourcePath, data)
        return data
Exemplo n.º 2
0
    def getSource(self,
                  url,
                  form_data,
                  referer='',
                  xml=False,
                  mobile=False,
                  ignoreCache=False,
                  demystify=False):
        if 'live.xml' in url:
            self.cachedSourcePath = url
            data = self.__getCachedSource()
            return data

        if url == self.getLastUrl() and not ignoreCache:
            data = self.__getCachedSource()
        else:
            data = super(CachedWebRequest,
                         self).getSource(url, form_data, referer, xml, mobile,
                                         demystify)
            if data:
                # Cache url
                self.__setLastUrl(url)
                # Cache page
                setFileContent(self.cachedSourcePath, data)
        return data
Exemplo n.º 3
0
    def getSource(self,
                  url,
                  form_data,
                  referer='',
                  xml=False,
                  mobile=False,
                  ignoreCache=False,
                  demystify=False):
        if 'tvone.xml' in url:
            self.cachedSourcePath = url
            data = self.__getCachedSource()
            return data
        if '.r.de.a2ip.ru' in url:
            parsed_link = urlparse.urlsplit(url)
            parsed_link = parsed_link._replace(
                netloc=parsed_link.netloc.replace('.r.de.a2ip.ru', '').decode(
                    'rot13'))
            url = parsed_link.geturl()
        if 'calls/get/source' in url:
            ignoreCache = True

        if url == self.getLastUrl() and not ignoreCache:
            data = self.__getCachedSource()
        else:
            data = super(CachedWebRequest, self).getSource(
                url, form_data, referer, xml, mobile, demystify)
            if data:
                # Cache url
                self.__setLastUrl(url)
                # Cache page
                setFileContent(self.cachedSourcePath, data)
        return data
Exemplo n.º 4
0
 def getSource(self, url, form_data, referer='', xml=False, mobile=False, ignoreCache=False, demystify=False):
     
     if url == self.getLastUrl() and not ignoreCache:
         data = self.__getCachedSource()
     else:
         data = super(CachedWebRequest,self).getSource(url, form_data, referer, xml, mobile, demystify)
         if data:
             # Cache url
             self.__setLastUrl(url)
             # Cache page
             setFileContent(self.cachedSourcePath, data)
     return data
Exemplo n.º 5
0
    def getSource(self, url, form_data, referer='', ignoreCache=False, demystify=False):

        if url == self.getLastUrl() and not ignoreCache:
            data = self.__getCachedSource()
        else:
            data = enc.smart_unicode(super(CachedWebRequest,self).getSource(url, form_data, referer, demystify))
            if data:
                # Cache url
                self.__setLastUrl(url)
                # Cache page
                setFileContent(self.cachedSourcePath, data)
        return data
Exemplo n.º 6
0
    def getSource(self, url, referer='', ignoreCache=False, demystify=False):

        if url == self.getLastUrl() and not ignoreCache:
            data = self.__getCachedSource()
        else:
            data = enc.smart_unicode(super(CachedWebRequest,self).getSource(url, referer, demystify))
            if data:
                # Cache url
                self.__setLastUrl(url)
                # Cache page
                setFileContent(self.cachedSourcePath, data)
        return data
Exemplo n.º 7
0
 def __setLastUrl(self, url):
     setFileContent(self.lastUrlPath, url)
Exemplo n.º 8
0
 def __setLastUrl(self, url):
     setFileContent(self.lastUrlPath, url)