From 0afb1e361fcc601bf2a0f0fe2ea69f6ae8bd14fd Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Tue, 18 May 2021 11:38:49 -0700 Subject: sitemaps: pdfs -> access --- extra/sitemap/README.md | 2 +- extra/sitemap/access_urls_query.sh | 14 ++++++++++++++ extra/sitemap/generate_sitemap_indices.py | 4 ++-- extra/sitemap/pdf_urls_query.sh | 14 -------------- 4 files changed, 17 insertions(+), 17 deletions(-) create mode 100755 extra/sitemap/access_urls_query.sh delete mode 100755 extra/sitemap/pdf_urls_query.sh (limited to 'extra') diff --git a/extra/sitemap/README.md b/extra/sitemap/README.md index 1a24620..53f9518 100644 --- a/extra/sitemap/README.md +++ b/extra/sitemap/README.md @@ -6,7 +6,7 @@ installed. Run these commands on a production machine. cd /srv/fatcat_scholar/sitemap /srv/fatcat_scholar/src/extra/sitemap/work_urls_query.sh - /srv/fatcat_scholar/src/extra/sitemap/pdf_urls_query.sh + /srv/fatcat_scholar/src/extra/sitemap/access_urls_query.sh /srv/fatcat_scholar/src/extra/sitemap/generate_sitemap_indices.py ## Background diff --git a/extra/sitemap/access_urls_query.sh b/extra/sitemap/access_urls_query.sh new file mode 100755 index 0000000..bc7035f --- /dev/null +++ b/extra/sitemap/access_urls_query.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +set -e # fail on error +set -u # fail if variable not set in substitution +set -o pipefail # fail if part of a '|' command fails + + +# query for specific works; about 8.6 million circa 2021-04-29 +fatcat-cli search scholar 'doc_type:work (fulltext.access_type:ia_file OR fulltext.access_type:wayback) (NOT biblio.arxiv_id:*) (NOT biblio.pmcid:*) (NOT biblio.publisher_type:big5) (year:<1926 OR tags:*)' --index-json --limit 0 \ + | pv -l \ + | jq '[.fulltext.access_type, .fulltext.access_url] | @tsv' -r \ + | rg -v '^null' \ + | ./transform_access_url.py \ + | split --lines 20000 - sitemap-access- -d -a 5 --additional-suffix .txt diff --git a/extra/sitemap/generate_sitemap_indices.py b/extra/sitemap/generate_sitemap_indices.py index ed4b38b..bfdc486 100755 --- a/extra/sitemap/generate_sitemap_indices.py +++ b/extra/sitemap/generate_sitemap_indices.py @@ -21,8 +21,8 @@ def index_entity(entity_type, output): def main(): with open('sitemap-index-works.xml', 'w') as output: index_entity("works", output) - with open('sitemap-index-pdfs.xml', 'w') as output: - index_entity("pdfs", output) + with open('sitemap-index-access.xml', 'w') as output: + index_entity("access", output) if __name__=="__main__": main() diff --git a/extra/sitemap/pdf_urls_query.sh b/extra/sitemap/pdf_urls_query.sh deleted file mode 100755 index fb1a4b8..0000000 --- a/extra/sitemap/pdf_urls_query.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env bash - -set -e # fail on error -set -u # fail if variable not set in substitution -set -o pipefail # fail if part of a '|' command fails - - -# query for specific works; about 8.6 million circa 2021-04-29 -fatcat-cli search scholar 'doc_type:work (fulltext.access_type:ia_file OR fulltext.access_type:wayback) (NOT biblio.arxiv_id:*) (NOT biblio.pmcid:*) (NOT biblio.publisher_type:big5) (year:<1926 OR tags:*)' --index-json --limit 0 \ - | pv -l \ - | jq '[.fulltext.access_type, .fulltext.access_url] | @tsv' -r \ - | rg -v '^null' \ - | ./transform_access_url.py \ - | split --lines 20000 - sitemap-pdfs- -d -a 5 --additional-suffix .txt -- cgit v1.2.3