Skip to content

Commit

Permalink
Update save plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Te-k committed Jun 27, 2022
1 parent c633383 commit 4e25340
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions harpoon/commands/save.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#! /usr/bin/env python
import requests
from harpoon.commands.base import Command
from harpoon.lib.utils import unbracket
from harpoon.lib.archiveis import ArchiveIs
Expand All @@ -23,27 +24,27 @@ def add_arguments(self, parser):
parser.add_argument('URL', help='URL to save')
self.parser = parser

def run(self, conf, args, plugins):
def run(self, args, plugins):
print("Saving in cache platforms:")
# Archive.is
try:
ai_url = ArchiveIs.capture(unbracket(args.URL))
except:
print("Impossible to save in archive.is, weird")
except requests.exceptions.TooManyRedirects:
print("Impossible to save in Archive.is")
else:
print("Archive.is: %s" % ai_url)

# Web Archive
try:
ao_url = ArchiveOrg.capture(unbracket(args.URL))
except:
print("Impossible to save in web archive, weird.")
except KeyError:
print("Impossible to save in Web Archive")
else:
print("Web Archive: %s" % ao_url)

# Perma.cc
if 'Permacc' in conf and 'key' in conf['Permacc']:
pc = Permacc(conf['Permacc']['key'])
if 'Permacc' in self._config_data and 'key' in self._config_data['Permacc']:
pc = Permacc(self._config_data['Permacc']['key'])
try:
saved = pc.archive_create(unbracket(args.URL))
except PermaccError:
Expand Down

0 comments on commit 4e25340

Please sign in to comment.