INSTALL: add some notes for about dependencies
[tweeper.git] / tests / fetch_facebook_page.sh
1 #!/bin/sh
2 #
3 # Facebook requires a CAPTCHA most of the times, so keep fetching the URL as
4 # long as needed, until the page is shown with no CAPTCHA.
5
6 set -e
7
8 USER_AGENT="Mozilla/5.0 (Windows NT 6.1; rv:22.0) Gecko/20130405 Firefox/22.0";
9
10 while true;
11 do
12   # Force language to en-us to make sure that the string matching works
13   OUTPUT=$(wget -nv --user-agent="$USER_AGENT" --header='Accept-Language: en-us' -O - -- "$1")
14   if echo $OUTPUT | grep -q -v "Security Check Required";
15   then
16     echo "$OUTPUT" > facebook.html
17     break
18   fi
19   sleep 5
20 done