NID=number

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

View File

@ -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