~nova/mag-fear-scraper

2e07bf295fbdfbe85945b3177b28a84b286404b8 — Nova Devereaux 1 year, 1 month ago cdb6dc1
Pie chart!
2 files changed, 105 insertions(+), 0 deletions(-)

M build.sh
A fear_counts.svg
M build.sh => build.sh +1 -0
@@ 4,3 4,4 @@ pup 'a[href*=":_"][href*="MAG"] attr{href}' < Episodes | sort -u | xargs -I {} w
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 labels=1 values=2 colors=auto; mv pie.svg fear_counts.svg

A fear_counts.svg => fear_counts.svg +104 -0
@@ 0,0 1,104 @@
<?xml version="1.0" encoding="iso-8859-1" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN" 
  "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd" [ 
<!ENTITY ff "font-family:">
<!ENTITY fs "font-size:">
<!ENTITY fw "font-weight:">
<!ENTITY fst "font-style:">
<!ENTITY sw "stroke-width:">
<!ENTITY as "text-anchor:start;">
<!ENTITY am "text-anchor:middle;">
<!ENTITY ae "text-anchor:end;">
]>
<!-- Generated by ploticus (http://ploticus.sourceforge.net/)
Title: ploticus-graphic
SVG Driver by B.Traill
-->
<svg xmlns="http://www.w3.org/2000/svg" 
  viewBox="0 0 317.60 196.21"      
  xmlns:xlink="http://www.w3.org/1999/xlink"
>
<g transform="translate(-21.20,-293.02)" >                                                       

<g style="fill:#000000;stroke:#000000;&ff;Helvetica;">
<g style="&sw;0.6;&fs;10pt;&as;">
<path d="M180 396l0.0002616 -72l2.16 0.03241l2.158 0.09717l2.154 0.1618l2.148 0.2264l2.14 0.2907l2.131 0.3548l2.119 0.4185l2.819 0.6604l-17.83 69.76z" fill="#ff0000" stroke="#ff0000"/>
</g><g style="fill:#ff0000;stroke:#ff0000;&sw;0.6;&fs;10pt;&as;">
<path d="M180 396l17.83 -69.76l2.084 0.5662l2.066 0.6284l2.047 0.6901l2.025 0.7512l2.002 0.8116l1.976 0.8713l1.949 0.9302l1.921 0.9882l2.39 1.334l-36.29 62.19z" fill="#0000ff" stroke="#0000ff"/>
</g><g style="fill:#0000ff;stroke:#0000ff;&sw;0.6;&fs;10pt;&as;">
<path d="M180 396l36.29 -62.19l1.849 1.116l1.815 1.171l1.779 1.225l1.741 1.278l1.702 1.33l1.661 1.38l1.619 1.429l1.576 1.477l1.531 1.524l1.767 1.879l-53.33 48.38z" fill="#00b200" stroke="#00b200"/>
</g><g style="fill:#00b200;stroke:#00b200;&sw;0.6;&fs;10pt;&as;">
<path d="M180 396l53.33 -48.38l1.427 1.621l1.378 1.663l1.327 1.704l1.276 1.743l1.223 1.781l1.169 1.816l1.114 1.851l1.058 1.883l1.001 1.914l0.9429 1.943l0.9869 2.21l-66.23 28.24z" fill="#eaea00" stroke="#eaea00"/>
</g><g style="fill:#eaea00;stroke:#eaea00;&sw;0.6;&fs;10pt;&as;">
<path d="M180 396l66.23 -28.24l0.8174 1.999l0.7571 2.023l0.6961 2.045l0.6344 2.065l0.5722 2.083l0.5095 2.099l0.4463 2.113l0.3827 2.126l0.3188 2.136l0.2545 2.145l0.2087 2.412l-71.83 5z" fill="#aa4caa" stroke="#aa4caa"/>
</g><g style="fill:#aa4caa;stroke:#aa4caa;&sw;0.6;&fs;10pt;&as;">
<path d="M180 396l71.83 -5l0.1177 2.157l0.05291 2.159l-0.01188 2.16l-0.07666 2.159l-0.1414 2.155l-0.206 2.15l-0.2704 2.143l-0.3345 2.134l-0.3984 2.123l-0.4619 2.11l-0.525 2.095l-0.617 2.177l-68.95 -20.72z" fill="#ff9e23" stroke="#ff9e23"/>
</g><g style="fill:#ff9e23;stroke:#ff9e23;&sw;0.6;&fs;10pt;&as;">
<path d="M180 396l68.95 20.72l-0.6526 2.059l-0.714 2.038l-0.7749 2.016l-0.835 1.992l-0.8944 1.966l-0.9529 1.938l-1.011 1.909l-1.067 1.878l-1.123 1.845l-1.178 1.81l-1.232 1.774l-1.347 1.818l-57.17 -43.76z" fill="#b2b2b2" stroke="#b2b2b2"/>
</g><g style="fill:#b2b2b2;stroke:#b2b2b2;&sw;0.6;&fs;10pt;&as;">
<path d="M180 396l57.17 43.76l-1.338 1.695l-1.389 1.654l-1.438 1.612l-1.485 1.568l-1.532 1.523l-1.577 1.476l-1.62 1.428l-1.662 1.379l-1.703 1.328l-1.742 1.277l-1.78 1.224l-3.617 2.257l-36.29 -62.19z" fill="#ff9999" stroke="#ff9999"/>
</g><g style="fill:#ff9999;stroke:#ff9999;&sw;0.6;&fs;10pt;&as;">
<path d="M180 396l36.29 62.19l-1.882 1.061l-1.913 1.004l-1.942 0.9458l-1.969 0.8871l-1.995 0.8276l-2.019 0.7674l-2.041 0.7065l-2.061 0.645l-2.08 0.5828l-2.096 0.5202l-2.111 0.4571l-2.124 0.3935l-4.065 0.5717l-7.99 -71.56z" fill="#b2ccff" stroke="#b2ccff"/>
</g><g style="fill:#b2ccff;stroke:#b2ccff;&sw;0.6;&fs;10pt;&as;">
<path d="M180 396l7.99 71.56l-2.15 0.2075l-2.155 0.1429l-2.159 0.07817l-2.16 0.01339l-2.159 -0.0514l-2.157 -0.1161l-2.152 -0.1808l-2.146 -0.2453l-2.138 -0.3095l-2.127 -0.3735l-2.115 -0.4371l-2.101 -0.5004l-3.948 -1.124l21.68 -68.66z" fill="#99cc99" stroke="#99cc99"/>
</g><g style="fill:#99cc99;stroke:#99cc99;&sw;0.6;&fs;10pt;&as;">
<path d="M180 396l-21.68 68.66l-2.05 -0.6811l-2.028 -0.7423l-2.005 -0.8028l-1.98 -0.8626l-1.953 -0.9216l-1.925 -0.9798l-1.895 -1.037l-1.863 -1.093l-1.829 -1.149l-1.794 -1.203l-1.757 -1.256l-1.718 -1.309l-1.678 -1.36l-2.959 -2.612l49.11 -52.65z" fill="#ffcc99" stroke="#ffcc99"/>
</g><g style="fill:#ffcc99;stroke:#ffcc99;&sw;0.6;&fs;10pt;&as;">
<path d="M180 396l-49.11 52.65l-1.557 -1.497l-1.512 -1.543l-1.465 -1.588l-1.416 -1.631l-1.367 -1.672l-1.316 -1.713l-1.264 -1.751l-1.211 -1.789l-1.157 -1.824l-1.101 -1.858l-1.045 -1.89l-0.9881 -1.921l-0.93 -1.949l-0.8711 -1.976l-0.8115 -2.002l-1.228 -3.417l68.35 -22.63z" fill="#ccb2cc" stroke="#ccb2cc"/>
</g><g style="fill:#ccb2cc;stroke:#ccb2cc;&sw;0.6;&fs;10pt;&as;">
<path d="M180 396l-68.35 22.63l-0.648 -2.06l-0.5859 -2.079l-0.5233 -2.096l-0.4602 -2.11l-0.3967 -2.123l-0.3328 -2.134l-0.2687 -2.143l-0.2043 -2.15l-0.1397 -2.155l-0.07496 -2.159l-0.01018 -2.16l0.05461 -2.159l0.1194 -2.157l0.184 -2.152l0.2485 -2.146l0.3127 -2.137l0.3767 -2.127l0.4403 -2.115l0.7569 -3.064l69.5 18.8z" fill="#d8d8d8" stroke="#d8d8d8"/>
</g><g style="fill:#d8d8d8;stroke:#d8d8d8;&sw;0.6;&fs;10pt;&as;">
<path d="M180 396l-69.5 -18.8l0.5951 -2.076l0.6571 -2.058l0.7185 -2.037l0.7793 -2.014l0.8394 -1.99l0.8987 -1.964l0.9572 -1.936l1.015 -1.907l1.072 -1.875l1.127 -1.842l1.182 -1.808l1.236 -1.771l1.288 -1.734l1.34 -1.694l1.39 -1.653l1.439 -1.611l1.487 -1.567l1.533 -1.522l2.32 -2.139l47.63 54z" fill="#b24c4c" stroke="#b24c4c"/>
</g><g style="fill:#b24c4c;stroke:#b24c4c;&sw;0.6;&fs;10pt;&as;">
<path d="M180 396l-47.63 -54l1.641 -1.404l1.682 -1.355l1.722 -1.303l1.761 -1.251l1.797 -1.198l1.832 -1.143l1.866 -1.088l1.898 -1.031l1.928 -0.974l1.956 -0.9158l1.983 -0.8567l2.008 -0.7968l2.031 -0.7362l2.052 -0.675l2.071 -0.6132l2.089 -0.5508l2.104 -0.4879l2.118 -0.4245l2.13 -0.3608l2.139 -0.2968l2.147 -0.2325l2.153 -0.168l2.157 -0.1033l2.364 -0.03881l-0.0005995 72z" fill="#000099" stroke="#000099"/>
</g><g style="&sw;0.5;&fs;10pt;&as;">
<path d="M180 396l0.0002616 -72l0 0l2.16 0.03241l2.158 0.09717l2.154 0.1618l2.148 0.2264l2.14 0.2907l2.131 0.3548l2.119 0.4185l2.819 0.6604l-17.83 69.76" fill="none"/>
<path d="M188.1 331.7l1.797 -14.29l83.72 0" fill="none"/>
</g><g style="&sw;0.5;&fs;8pt;&as;">
<text x="280.80" y="317.42" stroke="none">Extinction</text>
<path d="M180 396l17.83 -69.76l0 0l2.084 0.5662l2.066 0.6284l2.047 0.6901l2.025 0.7512l2.002 0.8116l1.976 0.8713l1.949 0.9302l1.921 0.9882l2.39 1.334l-36.29 62.19" fill="none"/>
<path d="M204.6 336l5.464 -13.32l63.55 0" fill="none"/>
<text x="280.80" y="322.72" stroke="none">Hunt</text>
<path d="M180 396l36.29 -62.19l0 0l1.849 1.116l1.815 1.171l1.779 1.225l1.741 1.278l1.702 1.33l1.661 1.38l1.619 1.429l1.576 1.477l1.531 1.524l1.767 1.879l-53.33 48.38" fill="none"/>
<path d="M220.8 345.7l9.067 -11.19l43.73 0" fill="none"/>
<text x="280.80" y="334.47" stroke="none">Slaughter</text>
<path d="M180 396l53.33 -48.38l0 0l1.427 1.621l1.378 1.663l1.327 1.704l1.276 1.743l1.223 1.781l1.169 1.816l1.114 1.851l1.058 1.883l1.001 1.914l0.9429 1.943l0.9869 2.21l-66.23 28.24" fill="none"/>
<path d="M234.6 361l12.12 -7.77l26.92 0" fill="none"/>
<text x="280.80" y="353.27" stroke="none">Lonely</text>
<path d="M180 396l66.23 -28.24l0 0l0.8174 1.999l0.7571 2.023l0.6961 2.045l0.6344 2.065l0.5722 2.083l0.5095 2.099l0.4463 2.113l0.3827 2.126l0.3188 2.136l0.2545 2.145l0.2087 2.412l-71.83 5" fill="none"/>
<path d="M243 380.8l14 -3.371l16.6 0" fill="none"/>
<text x="280.80" y="377.46" stroke="none">Vast</text>
<path d="M180 396l71.83 -5l0 0l0.1177 2.157l0.05291 2.159l-0.01188 2.16l-0.07666 2.159l-0.1414 2.155l-0.206 2.15l-0.2704 2.143l-0.3345 2.134l-0.3984 2.123l-0.4619 2.11l-0.525 2.095l-0.617 2.177l-68.95 -20.72" fill="none"/>
<path d="M244.4 403.2l14.31 1.598l14.89 0" fill="none"/>
<text x="280.80" y="404.79" stroke="none">Dark</text>
<path d="M180 396l68.95 20.72l0 0l-0.6526 2.059l-0.714 2.038l-0.7749 2.016l-0.835 1.992l-0.8944 1.966l-0.9529 1.938l-1.011 1.909l-1.067 1.878l-1.123 1.845l-1.178 1.81l-1.232 1.774l-1.347 1.818l-57.17 -43.76" fill="none"/>
<path d="M237.7 425.5l12.82 6.555l23.08 0" fill="none"/>
<text x="280.80" y="432.05" stroke="none">End</text>
<path d="M180 396l57.17 43.76l0 0l-1.338 1.695l-1.389 1.654l-1.438 1.612l-1.485 1.568l-1.532 1.523l-1.577 1.476l-1.62 1.428l-1.662 1.379l-1.703 1.328l-1.742 1.277l-1.78 1.224l-3.617 2.257l-36.29 -62.19" fill="none"/>
<path d="M222.9 444.6l9.526 10.8l41.21 0" fill="none"/>
<text x="280.80" y="455.39" stroke="none">Desolation</text>
<path d="M180 396l36.29 62.19l0 0l-1.882 1.061l-1.913 1.004l-1.942 0.9458l-1.969 0.8871l-1.995 0.8276l-2.019 0.7674l-2.041 0.7065l-2.061 0.645l-2.08 0.5828l-2.096 0.5202l-2.111 0.4571l-2.124 0.3935l-4.065 0.5717l-7.99 -71.56" fill="none"/>
<path d="M200.4 457.5l4.526 13.67l68.71 0" fill="none"/>
<text x="280.80" y="471.19" stroke="none">Buried</text>
<path d="M180 396l7.99 71.56l0 0l-2.15 0.2075l-2.155 0.1429l-2.159 0.07817l-2.16 0.01339l-2.159 -0.0514l-2.157 -0.1161l-2.152 -0.1808l-2.146 -0.2453l-2.138 -0.3095l-2.127 -0.3735l-2.115 -0.4371l-2.101 -0.5004l-3.948 -1.124l21.68 -68.66" fill="none"/>
<path d="M173.7 460.5l-1.399 14.33l-85.91 0" fill="none"/>
</g><g style="&sw;0.5;&fs;8pt;&ae;">
<text x="79.20" y="474.83" stroke="none">Flesh</text>
<path d="M180 396l-21.68 68.66l0 0l-2.05 -0.6811l-2.028 -0.7423l-2.005 -0.8028l-1.98 -0.8626l-1.953 -0.9216l-1.925 -0.9798l-1.895 -1.037l-1.863 -1.093l-1.829 -1.149l-1.794 -1.203l-1.757 -1.256l-1.718 -1.309l-1.678 -1.36l-2.959 -2.612l49.11 -52.65" fill="none"/>
<path d="M147.3 452l-7.258 12.44l-53.68 0" fill="none"/>
<text x="79.20" y="464.40" stroke="none">Web</text>
<path d="M180 396l-49.11 52.65l0 0l-1.557 -1.497l-1.512 -1.543l-1.465 -1.588l-1.416 -1.631l-1.367 -1.672l-1.316 -1.713l-1.264 -1.751l-1.211 -1.789l-1.157 -1.824l-1.101 -1.858l-1.045 -1.89l-0.9881 -1.921l-0.93 -1.949l-0.8711 -1.976l-0.8115 -2.002l-1.228 -3.417l68.35 -22.63" fill="none"/>
<path d="M125.4 431l-12.12 7.77l-26.92 0" fill="none"/>
<text x="79.20" y="438.73" stroke="none">Corruption</text>
<path d="M180 396l-68.35 22.63l0 0l-0.648 -2.06l-0.5859 -2.079l-0.5233 -2.096l-0.4602 -2.11l-0.3967 -2.123l-0.3328 -2.134l-0.2687 -2.143l-0.2043 -2.15l-0.1397 -2.155l-0.07496 -2.159l-0.01018 -2.16l0.05461 -2.159l0.1194 -2.157l0.184 -2.152l0.2485 -2.146l0.3127 -2.137l0.3767 -2.127l0.4403 -2.115l0.7569 -3.064l69.5 18.8" fill="none"/>
<path d="M115.2 397.8l-14.39 0.4002l-14.43 0" fill="none"/>
<text x="79.20" y="398.20" stroke="none">Eye</text>
<path d="M180 396l-69.5 -18.8l0 0l0.5951 -2.076l0.6571 -2.058l0.7185 -2.037l0.7793 -2.014l0.8394 -1.99l0.8987 -1.964l0.9572 -1.936l1.015 -1.907l1.072 -1.875l1.127 -1.842l1.182 -1.808l1.236 -1.771l1.288 -1.734l1.34 -1.694l1.39 -1.653l1.439 -1.611l1.487 -1.567l1.533 -1.522l2.32 -2.139l47.63 54" fill="none"/>
<path d="M125 361.8l-12.23 -7.601l-26.33 0" fill="none"/>
<text x="79.20" y="354.20" stroke="none">Spiral</text>
<path d="M180 396l-47.63 -54l0 0l1.641 -1.404l1.682 -1.355l1.722 -1.303l1.761 -1.251l1.797 -1.198l1.832 -1.143l1.866 -1.088l1.898 -1.031l1.928 -0.974l1.956 -0.9158l1.983 -0.8567l2.008 -0.7968l2.031 -0.7362l2.052 -0.675l2.071 -0.6132l2.089 -0.5508l2.104 -0.4879l2.118 -0.4245l2.13 -0.3608l2.139 -0.2968l2.147 -0.2325l2.153 -0.168l2.157 -0.1033l2.364 -0.03881l-0.0005995 72" fill="none"/>
<path d="M157.1 335.4l-5.092 -13.47l-65.6 0" fill="none"/>
<text x="79.20" y="321.92" stroke="none">Stranger</text>
</g></g>
</g>
</svg>