aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Czygan <martin.czygan@gmail.com>2021-06-09 02:20:18 +0200
committerMartin Czygan <martin.czygan@gmail.com>2021-06-09 02:20:18 +0200
commite3f0f48ba912f8afc7c9ffebb6ec4d6692231ce6 (patch)
tree6abf587c0d4026f49d7f744e193bb5f9ff11e7c6
parent52f42013cb041a70fc8bb196e24d2be1fe5af531 (diff)
downloadrefcat-e3f0f48ba912f8afc7c9ffebb6ec4d6692231ce6.tar.gz
refcat-e3f0f48ba912f8afc7c9ffebb6ec4d6692231ce6.zip
add: URLTabsCleaned
-rw-r--r--python/refcat/tasks.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/python/refcat/tasks.py b/python/refcat/tasks.py
index 63b12f4..698ef24 100644
--- a/python/refcat/tasks.py
+++ b/python/refcat/tasks.py
@@ -460,6 +460,28 @@ class URLTabs(Refcat):
def output(self):
return luigi.LocalTarget(path=self.path(ext="tsv.zst"), format=Zstd)
+class URLTabsCleaned(Refcat):
+ """
+ URLTabs, cleaned.
+ """
+ def requires(self):
+ return URLTabs()
+
+ def run(self):
+ output = shellout("""
+ zstdcat -T0 {input} |
+ skate-cleanup -X -c url -B -S -f 3 |
+ LC_ALL=C sort -u -T {tmpdir} -k3,3 -S25% --parallel 4 |
+ LC_ALL=C grep -E '^https?://' |
+ 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)
class URLList(Refcat):
"""