#!/bin/bash # # Ghetto but effective Newspaper/Comic script. Created by Jeremy Sands (http://www.jeremysands.com) # License: GPLv3 # # IMPORTANT: ONLY RUN THIS SCRIPT IN ITS OWN DEDICATED SUBFOLDER. THERE ARE UNSAFE DELETE COMMANDS IF THIS # SCRIPT IS PLACED WITH OTHER THINGS. YOU'LL ALSO WANT TO GREP FOR "FIXME" TO ADJUST VARIABLES SPECIFIC TO # YOUR USE CASE, SUCH AS YOUR KINDLE EMAIL. # # I am using Newseum to scrape the newspaper front pages from a bunch of newspapers in the region. Note that # Newseum is changing the file path based upon the date. Also note that qpdf is needed to decrypt the pdfs to # allow for error free concatenation. # # Lastly ... YES I KNOW the script can be reduced to 1/3 to 1/2 its size with some variables and loops. I'm # not interested in that just yet, I like to keep things "exploded out" like they are to make debugging easier, # since I don't know how often this script will need to be changed yet. # # ============================================================================================================ # ============================================================================================================ # ============================================================================================================ # # ===== Newspaper Front Pages ===== # wget --referer="http://www.newseum.org/todaysfrontpages/" "http://cdn.newseum.org/dfp/pdf`date +%d`/SC_HJ.pdf" ; qpdf --decrypt SC_HJ.pdf SC_HJ_D.pdf ; sleep 2s ; wget --referer="http://www.newseum.org/todaysfrontpages/" "http://cdn.newseum.org/dfp/pdf`date +%d`/SC_GN.pdf" ; qpdf --decrypt SC_GN.pdf SC_GN_D.pdf ; sleep 2s ; wget --referer="http://www.newseum.org/todaysfrontpages/" "http://cdn.newseum.org/dfp/pdf`date +%d`/SC_TS.pdf" ; qpdf --decrypt SC_TS.pdf SC_TS_D.pdf ; sleep 2s ; wget --referer="http://www.newseum.org/todaysfrontpages/" "http://cdn.newseum.org/dfp/pdf`date +%d`/NC_ACT.pdf" ; qpdf --decrypt NC_ACT.pdf NC_ACT_D.pdf ; sleep 2s ; wget --referer="http://www.newseum.org/todaysfrontpages/" "http://cdn.newseum.org/dfp/pdf`date +%d`/NC_CO.pdf" ; qpdf --decrypt NC_CO.pdf NC_CO_D.pdf ; sleep 2s ; wget --referer="http://www.newseum.org/todaysfrontpages/" "http://cdn.newseum.org/dfp/pdf`date +%d`/GA_AJC.pdf" ; qpdf --decrypt GA_AJC.pdf GA_AJC_D.pdf ; sleep 2s ; pdfunite SC_GN_D.pdf SC_HJ_D.pdf SC_TS_D.pdf NC_CO_D.pdf NC_ACT_D.pdf GA_AJC_D.pdf Final/"Newspapers-`date +%F`.pdf" ; rm *pdf ; # # ===== Comic Strips ===== # # FIXME-PUT-YOUR-OWN-COMICS-HERE-INSTEAD-OF-MINE ~/.local/bin/dosage --adult -b . AbstruseGoose GoComics/FoxTrotClassics xkcd GoComics/FoxTrot Dilbert GoComics/CalvinAndHobbes GoComics/WizardOfId Bizarro GoComics/Overboard GoComics/PearlsBeforeSwine MotherGooseAndGrimm GoComics/NonSequitur SMBC GoComics/InTheBleachers PennyArcade GoComics/BC ToonHole GoComics/GetFuzzy GoComics/Garfield ; mv */*png . ; mv */*/*png . ; mv */*jpg . ; mv */*/*jpg . ; mv */*gif . ; mv */*/*gif . ; mogrify -format pdf *jpg ; mogrify -format pdf *gif ; mogrify -format pdf *png ; pdfunite *pdf Final/"Comics-`date +%F`.pdf" ; rm *pdf *jpg *gif *png ; # # ===== Email Final PDFs ===== # mpack -s "Daily Comics" Final/Comics*.pdf FIXME-PUT-YOUR-KINDLE-EMAIL-HERE ; mpack -s "Daily Papers" Final/Newspapers*.pdf FIXME-PUT-YOUR-KINDLE-EMAIL-HERE