Last active
June 25, 2018 09:06
-
-
Save Steven-Chan/f9fb3ce5796f1cb3df00ad0838ba22ea to your computer and use it in GitHub Desktop.
Goodnuts.hk scrapper
This file contains 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 | |
# usage: | |
# ./goodnuts-scrapper.sh 星期一 | |
# ./goodnuts-scrapper.sh 星期二 | |
day=$1 | |
wget -q http://goodnuts.hk/ -O - \ | |
| tr '\n' ' ' \ | |
| perl -nle "print $& if m{<tr> <th>$day</th>.*?</tr>}" \ | |
| perl -pe 's/(<\/th>|<\/tr>|<\/td>|<th>|<tr>|<td>)/\n/g' \ | |
| sed -n 3,9p \ | |
| sed '/^ $/d' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment