diff --git a/dhiraaguscrap/scrap.sh b/dhiraaguscrap/scrap.sh index 41f82bd6..07566c9a 100644 --- a/dhiraaguscrap/scrap.sh +++ b/dhiraaguscrap/scrap.sh @@ -1,12 +1,12 @@ #/bin/bash -START_NID=$1 -NID=$START_NID -END_NID=$2 +START_NUMBER=$1 +NUMBER=$START_NUMBER +END_NUMBER=$2 FILENAME=${1}-${2}.json -while [ "$START_NID" -le "$END_NID" ]; +while [ "$START_NUMBER" -le "$END_NUMBER" ]; do - echo Scraping: $NID # print - CONTENT=$(curl -sihttps://app-production.dhiraagu.com.mv/io/v1/info/subscribers/$NID/dir > .cache) # curl output with http headers and data + echo Scraping: $NUMBER # print + CONTENT=$(curl -sihttps://app-production.dhiraagu.com.mv/io/v1/info/subscribers/$NUMBER/dir > .cache) # curl output with http headers and data DATA=$(cat .cache | tail -n1) # get the json data from last line HTTP_STATUS=$(cat .cache | head -n1 | awk '{print $2}') # get the http code from first line @@ -14,14 +14,14 @@ do then if [ "$DATA" = "null" ] then - echo $NID | tee -a norecords + echo $NUMBER | tee -a norecords else echo $DATA | tee -a $FILENAME # printf "\n" | tee -a $FILENAME fi - START_NID=$(echo $[$START_NID+1]) - printf -v NID "%06d" $START_NID + START_NUMBER=$(echo $[$START_NUMBER+1]) + printf -v NUMBER "%06d" $START_NUMBER sleep 3.5 else