Beispiel #1
0
    def _get_standalone(self, uri):
        filename = urlparse(uri).path[1:]
        if archive.misc_exists(filename):
            data = archive.misc_load(filename)
        else:
            data = urlopen(uri).readall()

        html = data.decode('iso8859-1')

        modhtml = re.sub(site_logo, archive.logo_path(filename), html)
        modhtml = re.sub(r'src="{0}(.*?)"'.format(site_prefix), r'src="../\1"', modhtml)
        
        archive.save_misc(filename, modhtml.encode('iso8859-1'))

        for img in re.findall(r'src="(.*?)"', html):
            if 'logo' in img:    # site logo
                pass
            elif '..' in img or 'extras' in img:  # donation command images
                self._get_other(img)
            else:                          # wayward vagabond images
                self._get_other('{0}{1}'.format(uri, img))
Beispiel #2
0
 def _get_other(self, uri):
     filename = urlparse(uri).path[1:]
     if not archive.misc_exists(filename):
         data = urlopen(uri).readall()
         archive.save_misc(filename, data)