From 8b2558c60eb8bef5a8d96371422e23b6df15fe0b Mon Sep 17 00:00:00 2001 From: Martin Czygan Date: Thu, 15 Jul 2021 03:47:26 +0200 Subject: tasks: add RefsURL --- python/refcat/tasks.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'python') diff --git a/python/refcat/tasks.py b/python/refcat/tasks.py index 969d8dd..c04ec3c 100644 --- a/python/refcat/tasks.py +++ b/python/refcat/tasks.py @@ -1463,3 +1463,29 @@ class BrefZipWikiDOI(Refcat): def output(self): return luigi.LocalTarget(path=self.path(ext="json.zst"), format=Zstd) + + +# Wayback related + +class RefsURL(Refcat): + """ + Extract (url, doc), sort by url. + """ + def requires(self): + return RefsWithUnstructured() + + def run(self): + output = shellout(""" + zstdcat -T0 {input} | + skate-map -m ur -skip-on-empty 1 | + LC_ALL=C sort -T {tmpdir} -k1,1 -S25% | + zstd -T0 -c > {output} + """, + n=self.n, + tmpdir=self.tmpdir, + input=self.input().path) + luigi.LocalTarget(output).move(self.output().path) + + def output(self): + return luigi.LocalTarget(path=self.path(ext="tsv.zst"), format=Zstd) + -- cgit v1.2.3