Download fetch.sh from zaaabik/reference_papers: direct link, hf CLI and curl.
- Browser
- Download file 1.03 kB
-
https://huggingface.co/datasets/zaaabik/reference_papers/resolve/main/fetch.sh
- Command line
-
hf download hf://datasets/zaaabik/reference_papers/fetch.sh
-
curl -L -o fetch.sh https://huggingface.co/datasets/zaaabik/reference_papers/resolve/main/fetch.sh
1.03 kB
| # Download every paper in manifest.tsv into reference_papers/<venue>/<year>_<slug>.pdf | |
| # Skips files already present and valid. Polite to arXiv (3 s between requests). | |
| cd "$(dirname "$0")" | |
| UA="Mozilla/5.0 (X11; Linux x86_64) reference-fetch/1.0" | |
| ok=0; bad=0 | |
| while IFS=$'\t' read -r venue year slug source title; do | |
| [[ "$venue" == \#* || -z "$venue" ]] && continue | |
| dir="$venue"; out="$dir/${year}_${slug}.pdf"; mkdir -p "$dir" | |
| if [ -s "$out" ] && head -c4 "$out" | grep -q '%PDF'; then ok=$((ok+1)); continue; fi | |
| case "$source" in | |
| acl:*) url="https://aclanthology.org/${source#acl:}.pdf" ;; | |
| arxiv:*) url="https://arxiv.org/pdf/${source#arxiv:}"; sleep 3 ;; | |
| url:*) url="${source#url:}" ;; | |
| esac | |
| curl -sL -m 120 -A "$UA" -o "$out" "$url" | |
| if head -c4 "$out" 2>/dev/null | grep -q '%PDF'; then ok=$((ok+1)); echo "ok $out" | |
| else bad=$((bad+1)); echo "FAIL $out <- $url ($(file -b "$out" | cut -c1-30))"; rm -f "$out"; fi | |
| done < manifest.tsv | |
| echo "downloaded/valid: $ok failed: $bad" | |