Last active
February 28, 2019 06:54
-
-
Save pbamotra/279e73847ba5bba0f4d54c6f993e8a32 to your computer and use it in GitHub Desktop.
Press releases from Press Information Bureau, India on Mac terminal
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Mac instructions: - | |
# 0. Install brew -- https://brew.sh/ | |
# ```/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"``` | |
# 1. Install pup -- https://github.com/ericchiang/pup | |
# ```$ brew install https://raw.githubusercontent.com/EricChiang/pup/master/pup.rb``` | |
# 2. Install jq -- https://stedolan.github.io/jq/ | |
# ```$ brew install jq``` | |
alias news="curl -sL 'http://pib.nic.in/AllRelease.aspx?MenuId=3' -H 'Connection: keep-alive' -H 'Cache-Control: max-age=0' -H 'Origin: http://pib.nic.in' -H 'Upgrade-Insecure-Requests: 1' -H 'DNT: 1' -H 'Content-Type: application/x-www-form-urlencoded' -H 'User-Agent: Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Mobile Safari/537.36' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8' -H 'Referer: http://pib.nic.in/AllRelease.aspx?MenuId=3' -H 'Accept-Encoding: gzip, deflate' -H 'Accept-Language: en-GB,en-US;q=0.9,en;q=0.8' --compressed | pup '#ContentPlaceHolder1_lblDate, [href^=\"/PressRelese\"] json{}' | jq -r '.[] | .text, \"http://pib.nic.in\" + .href, .blank'" | |
# $ news |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment