def main():
    server = MementoIndexServer(
        ["http://timetravel.mementoweb.org/api/json/", "http://timetravel.mementoweb.org/timemap/json/"]
    )
    redis_client.init_redis()

    cdx_iter = server.load_cdx(closest=sys.argv[1], url=sys.argv[2], sort="closest", limit=int(sys.argv[3]))
    sec = None
    for cdx in cdx_iter:
        if not sec:
            sec = cdx["sec"]
        # print(cdx['timestamp'] + ' ' + cdx['url'] + ' ' + cdx['src_host'] + ' ' + str(sec - cdx['sec']))
        print (cdx["prev"] + " " + cdx["timestamp"] + " " + cdx["next"] + " " + str(sec - cdx["sec"]))
    def __init__(self, config):
        self.session = requests.Session()
        # init redis here only
        redis_client.init_redis(config)

        self.load_archive_info_xml(config.get('memento_archive_xml'))