Hi,
I have tried to pull the usertime line tweets for multiple screen names.
For the first time I have called the twitter API for one screenName and I got the data in 16 pages.
For the second time again I have called the twitter API with a different screenName and I got the data in only 4 pages but the API is keeping on retrying for the page 5 which has no data and it is entering into the infinite loop.
I got the below below mentioned error messages, It’s not even stopping until I kill it manually.
{“errors”:[{“code”:32,“message”:“Could not authenticate you.”}]}
{“errors”:[{“message”:“Rate limit exceeded”,“code”:88}]}
Parameters: count=3200&screen_name=McDonaldsCorp&Since_ID=“SOME VALUE”&page="pageno"
Logic: timestamp=date +%s
nonce=date +%s%T | openssl base64 | sed -e s'/[+=/]//g'
signature_base_string=“GET&https%3A%2F%2Fapi.twitter.com%2F1.1%2Fstatuses%2Fuser_timeline.json&oauth_consumer_key%3D${consumer_key}%26oauth_nonce%3D${nonce}%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D${timestamp}%26oauth_token%3D${oauth_token}%26oauth_version%3D1.0%26page%3D${pageNo}%26screen_name%3D${screen_name}%26since_id%3D${since_id}”
signature_key="${consumer_secret}&${oauth_secret}“
oauth_signature=echo -n ${signature_base_string} | openssl dgst -sha1 -hmac ${signature_key} -binary | openssl base64 | sed -e s'/+/%2B/' -e s'/\//%2F/' -e s'/=/%3D/'
header=“Authorization: OAuth oauth_consumer_key=”${consumer_key}”, oauth_nonce="${nonce}", oauth_signature="${oauth_signature}", oauth_signature_method=“HMAC-SHA1”, oauth_timestamp="${timestamp}", oauth_token="${oauth_token}", oauth_version=“1.0"”
curl --get “https://api.twitter.com/1.1/statuses/user_timeline.json” --data “screen_name=${screen_name}&page=${pageNo}&since_id=${since_id}” --header “Content-Type: application/x-www-form-urlencoded” --header “${header}” > ${screen_name}_$pageNo.json
How can I stop the API call if there is no data ?
Regards,
Aswin