This commit is contained in:
Shihaam Abdul Rahman 2023-02-11 01:32:39 +05:00
parent 075e283ffd
commit a0aec8e7e4
Signed by: shihaam
GPG Key ID: 5641D129E0B55604

View File

@ -4,10 +4,10 @@ END_NID=$2
FILENAME=A${1}-A${2}.json
while [ "$START_NID" -le "$END_NID" ];
do
echo Scraping: $START_NID
CONTENT=$(curl -si https://fikureggedhirun.com/api/fetch?nic=A$START_NID > .cache)
DATA=$(cat .cache | tail -n1)
HTTP_STATUS=$(cat .cache | head -n1 | awk '{print $2}')
echo Scraping: $START_NID # print
CONTENT=$(curl -si https://fikureggedhirun.com/api/fetch?nic=A$START_NID > .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