Oct 292014
 

This morning I set out on a quest to grab ESPN’s latest headlines using pup.

Long story short: I couldn’t figure out how to do it using pup alone.

Luckily, Eric Chiang (pup’s creator) came to my rescue with a solution using pup and jq in combination, and I’ve since written a command-line script for grabbing ESPN’s latest headlines, as well as modified my motd to include them!

https://gist.github.com/loisaidasam/2625769862c81f943f58

Happy ESPN’ing! :)

Oct 012014
 

Ever since I found out about pup I can’t stop using it. I absolutely love it. So why not post another use case?

I’ve had my eye on the CMJ Artists Lineup page and figured that’s a good enough use case:

curl -s http://www.cmj.com/marathon/cmj-2014-artists/ | pup .one-half .entry-title text{} | grep -v "Playing CMJ 2014"

VOILA!

https://gist.github.com/loisaidasam/624523054327cd819dc1

Can you tell that I’m super excited for CMJ?!

Sep 172014
 

I just came across (via jdp) this awesome command line dealie called pup:

https://github.com/EricChiang/pup

Totally awesome! The HTML equivalent to jq, it allows you to parse HTML using CSS selectors from the command line.

For example, say I wanted to get the top 10 current headlines from Hacker News:

$ curl https://news.ycombinator.com | pup td.title a text{} | head -n 10
Artificial sweeteners induce glucose intolerance by altering the gut microbiota
Show HN: CleverDeck – I built the spaced repetition app I always wanted
I was asked to crack a program in a job interview
Stuff Goes Bad: Erlang in Anger
Suture – Supervisor Trees for Go
The Design and Implementation of the FreeBSD Operating System, 2nd ed.
Easel Is Shutting Down
Dremel Releases a Mass-Market 3D Printer
The Traveling Salesman with Simulated Annealing, R, and Shiny
The New Yahoo Developer Network

SO COOL!!!

How about another example: let’s grab all mentions of apple-related things on the first 5 pages of Hacker News to see how popular all of this insanity is these days:

$ for page in {1..5} ; do curl -s -S https://news.ycombinator.com/news?p=$page | pup td.title a text{} | awk '{print tolower($0)}' | egrep 'apple|ios|osx|swift|xcode|iphone' ; done ;
ios 8 reviewed
swype - ios 8 keyboard
stripe lands apple in quest for $720b in payments
ios8 adoption, hour by hour
ios 8 review
why apple didn't use sapphire for iphone screens
a history of misses for radioshack
predictive photo sharing with ios8
everything that went wrong while building the tumblr ios share extension
apple pay and nfc are obsolete: this is how payments could work in the future
the iphones 6
apple watch: initial thoughts and observations
build your own apple ibeacon with a raspberry pi
interactive iphone 6 experiment in webgl

So awesome!!! Thank you Eric Chiang!