💾 Archived View for p.d2evs.net › 833604777.txt captured on 2024-06-20 at 12:20:46.
-=-=-=-=-=-=-
#!/bin/sh rm -rf /tmp/apgte mkdir /tmp/apgte curl -s 'https://practicalguidetoevil.wordpress.com/table-of-contents/' | hq 'sel [class=entry-content]' | grep -v sharedaddy | grep -v jp-relatedposts | while read line; do printf '%s' "$line" | grep -q "</h2>$" && { printf 'book\t%s\n' "$line" | sed 's/<[^<>]*>//g' } || { printf '%s' "$line" | hq 'sel a | totext' | sed -e 's/ ( /\t/' -e 's/..$//' } done | while read -r line; do echo $line test "$(printf '%s' "$line" | cut -f 1)" = "book" && { echo $book.pdf test -n "$book" && weasyprint /tmp/"$book.html" /tmp/apgte/"$book.pdf" echo Commentated $book.pdf test -n "$book" && weasyprint /tmp/"Commentated $book.html" /tmp/apgte/"Commentated $book.pdf" book="$(printf '%s' "$line" | cut -f 2)" printf "<h1>%s</h1><hr>" "$book" >/tmp/"$book.html" printf "<h1>%s</h1><hr>" "$book" >/tmp/"Commentated $book.html" } || { curl -s "$(printf '%s' "$line" | cut -f 2)" >/tmp/apgte.html { printf '<h2>' printf '%s' "$line" | cut -f 1 printf '</h2>' hq 'sel [class=entry-content]' </tmp/apgte.html | grep -v sharedaddy | grep -v jp-relatedposts } >> /tmp/"$book.html" { printf '<h2>' printf '%s' "$line" | cut -f 1 printf '</h2>' hq 'sel [class=entry-content]' </tmp/apgte.html | grep -v sharedaddy | grep -v jp-relatedposts printf '<br><br><hr><br><br>' hq 'sel .comment-content p:not(:last-child), .comment-author cite' </tmp/apgte.html >/tmp/comments.html hq 'sel li.comment | . class' </tmp/apgte.html | while read -r line; do line="$(printf %s "$line" | tr ' ' '\n' | grep '^depth-' | sed 's/depth-//')" printf '<div style="padding: 0 0 0 %sem;">' "$((line - 1))" awk 'BEGIN { a = 0 } /^<cite / { a++ } { if (a > 1) { print >>"/tmp/comments2.html" } else { print } }' </tmp/comments.html [ -f /tmp/comments2.html ] && mv /tmp/comments2.html /tmp/comments.html printf '</div>' done printf '<br><br><hr><br><br>' } >> /tmp/"Commentated $book.html" } done echo $book.pdf test -n "$book" && weasyprint /tmp/"$book.html" /tmp/apgte/"$book.pdf" echo Commentated $book.pdf test -n "$book" && weasyprint /tmp/"Commentated $book.html" /tmp/apgte/"Commentated $book.pdf" printf "<h1>Extra Chapters</h1><hr>" >/tmp/"Extra Chapters.html" printf "<h1>Extra Chapters</h1><hr>" >/tmp/"Commentated Extra Chapters.html" curl -s 'https://practicalguidetoevil.wordpress.com/extra-chapters/' | hq 'sel [class=entry-content]' | grep -v sharedaddy | grep -v jp-relatedposts | while read line; do printf '%s' "$line" | hq 'sel a | totext' | sed -e 's/ ( /\t/' -e 's/..$//' done | while read -r line; do echo $line curl -s "$(printf '%s' "$line" | cut -f 2)" >/tmp/apgte.html { printf '<h2>' printf '%s' "$line" | cut -f 1 printf '</h2>' hq 'sel [class=entry-content]' </tmp/apgte.html | grep -v sharedaddy | grep -v jp-relatedposts } >> /tmp/"Extra Chapters.html" { printf '<h2>' printf '%s' "$line" | cut -f 1 printf '</h2>' hq 'sel [class=entry-content]' </tmp/apgte.html | grep -v sharedaddy | grep -v jp-relatedposts printf '<br><br><hr><br><br>' hq 'sel .comment-content p:not(:last-child), .comment-author cite' </tmp/apgte.html >/tmp/comments.html hq 'sel li.comment | . class' </tmp/apgte.html | while read -r line; do line="$(printf %s "$line" | tr ' ' '\n' | grep '^depth-' | sed 's/depth-//')" printf '<div style="padding: 0 0 0 %sem;">' "$((line - 1))" awk 'BEGIN { a = 0 } /^<cite / { a++ } { if (a > 1) { print >>"/tmp/comments2.html" } else { print } }' </tmp/comments.html [ -f /tmp/comments2.html ] && mv /tmp/comments2.html /tmp/comments.html printf '</div>' done printf '<br><br><hr><br><br>' } >> /tmp/"Commentated Extra Chapters.html" done echo Extra Chapters weasyprint "/tmp/Extra Chapters.html" "/tmp/apgte/Extra Chapters.pdf" echo Commentated Extra Chapters weasyprint "/tmp/Commentated Extra Chapters.html" "/tmp/apgte/Commentated Extra Chapters.pdf"