webcache/memento.py
def snapshots(self, url):
        """
        Download list of snapshots for an url
        """
        r = requests.get(urljoin(self.base_url + 'timemap/', quote(url, safe='')), timeout=3)
        if r.status_code != 200:
            return []
        else:
            links = self._parselinks(r.text)
            # Get original url
            originals = list(
                filter(
                    lambda x: x['type'] == 'original',
                    links
                )
            )
            if len(originals) == 0:
                return []
            original = originals[0]['url']
            # Sort snapshots
            snapshots = []
            for d in links:
                if d['type'] in ['memento', 'first last memento']:
                    snapshots.append({
                        'url': original,
                        'date':d['date'],
                        'archive': d['url']
                    })
            return snapshots

        Download list of snapshots for an url
        
Download list of snapshots for an url
Download list of snapshots for an url
def snapshots(self, url):
        r = requests.get(urljoin(self.base_url + 'timemap/', quote(url, safe='')), timeout=3)
        if r.status_code != 200:
            return []
        else:
            links = self._parselinks(r.text)
            originals = list(
                filter(
                    lambda x: x['type'] == 'original',
                    links
                )
            )
            if len(originals) == 0:
                return []
            original = originals[0]['url']
            snapshots = []
            for d in links:
                if d['type'] in ['memento', 'first last memento']:
                    snapshots.append({
                        'url': original,
                        'date':d['date'],
                        'archive': d['url']
                    })
            return snapshots
def snapshots ( self , url ) : r = requests . get ( urljoin ( self . base_url + 'timemap/' , quote ( url , safe = '' ) ) , timeout = 3 ) if r . status_code != 200 : return [ ] else : links = self . _parselinks ( r . text ) originals = list ( filter ( lambda x : x [ 'type' ] == 'original' , links ) ) if len ( originals ) == 0 : return [ ] original = originals [ 0 ] [ 'url' ] snapshots = [ ] for d in links : if d [ 'type' ] in [ 'memento' , 'first last memento' ] : snapshots . append ( { 'url' : original , 'date' : d [ 'date' ] , 'archive' : d [ 'url' ] } ) return snapshots
Download list of snapshots for an url
Download list of snapshots for an url
"""
        Download list of snapshots for an url
        """ # Get original url # Sort snapshots
self
url