diff options
-rw-r--r-- | python/refcat/tasks.py | 26 |
1 files changed, 26 insertions, 0 deletions
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) + |