From 819a68b72c5aa330a3f7a6b91e1581163a62d9f3 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Tue, 5 Jan 2021 19:56:29 -0800 Subject: doaj ingest request updates (from prod) --- python/scripts/doaj2ingestrequest.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'python/scripts') diff --git a/python/scripts/doaj2ingestrequest.py b/python/scripts/doaj2ingestrequest.py index b981ab6..a7214d0 100755 --- a/python/scripts/doaj2ingestrequest.py +++ b/python/scripts/doaj2ingestrequest.py @@ -83,6 +83,7 @@ def transform(obj: dict) -> List[dict]: ingest_types = CONTENT_TYPE_MAP.get((link.get('content_type') or '').lower()) if not ingest_types: continue + skip = False for domain in DOMAIN_BLOCKLIST: if domain in link['url'].lower(): @@ -90,10 +91,13 @@ def transform(obj: dict) -> List[dict]: if skip: continue try: - base_url = canon(link['url']) + base_url = canon(link['url'].strip()) except UnicodeEncodeError: continue + if not base_url or len(base_url) > 1000: + continue + for ingest_type in ingest_types: request = { 'base_url': base_url, -- cgit v1.2.3