added dhiraagu scrapper

This commit is contained in:
Shihaam Abdul Rahman 2023-02-28 10:58:33 +05:00
parent 22f651465c
commit 263adcd452
Signed by: shihaam
GPG Key ID: 6DA2E87EBC227636

31
dhiraaguscrap/scrap.sh Normal file
View File

@ -0,0 +1,31 @@
#/bin/bash
START_NID=$1
NID=$START_NID
END_NID=$2
FILENAME=${1}-${2}.json
while [ "$START_NID" -le "$END_NID" ];
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
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
if [ "$HTTP_STATUS" = "200" ]
then
if [ "$DATA" = "null" ]
then
echo $NID | 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
sleep 3.5
else
echo delaying
sleep 70
fi
done