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