~nova/mag-fear-scraper

mag-fear-scraper/build.sh -rw-r--r-- 932 bytes
3379d411 — Nova Devereaux Update labels with numbers 1 year, 3 months ago
                                                                                
1
2
3
4
5
6
7
#!/bin/sh
wget https://the-magnus-archives.fandom.com/wiki/Episodes
pup 'a[href*=":_"][href*="MAG"] attr{href}' < Episodes | sort -u | xargs -I {} wget https://the-magnus-archives.fandom.com{}
fgrep Related\ Entity MAG* -A 3 | fgrep href | perl -pe 'y/_/ /; s/-//; s/<div.*?">//; s/<\/div>//; s/<a.*?>(.*?)<\/a>[^<]*/$1, /g; s/<.*?>//g; s/(\t.*)(?:Primarily|Possibly) /$1/; s/, $//; $_ .= "\n"' | sort -k 2 -n > episode_fear_list_denormalized.tsv
perl -ne 'chomp; @f = split "\t"; ($id) = ($f[0] =~ /([0-9]*):/); $f[1] =~ s/The //g; @g = split ", ", $f[1]; print "$id\t$_\n" foreach @g' < episode_fear_list_denormalized.tsv > episode_fear_list_normalized.tsv
cut -f 2 episode_fear_list_normalized.tsv | sort | uniq -c | sort -n | perl -ane '@F[0] =~ s/^ *//; print "$F[1]\t$F[0]\n"' > fear_counts.tsv
ploticus -prefab pie -svg data=fear_counts.tsv delim=tab "labelfmtstring=@1 (@2)" values=2 colors=auto; mv pie.svg fear_counts.svg