fix 000002 issue

This commit is contained in:
Shihaam Abdul Rahman 2023-02-11 02:03:11 +05:00
parent a0aec8e7e4
commit 62b7f946f2
Signed by: shihaam
GPG Key ID: 5641D129E0B55604
2 changed files with 20 additions and 3 deletions

15
.cache Normal file
View File

@ -0,0 +1,15 @@
HTTP/2 200
date: Fri, 10 Feb 2023 21:02:17 GMT
content-type: application/json; charset=utf-8
etag: W/"109gcwx93k0as"
vary: Accept-Encoding
x-do-app-origin: aa8d031b-d5a9-4f77-90a3-fd4b557dee6b
cache-control: private
x-do-orig-status: 200
cf-cache-status: DYNAMIC
report-to: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=%2FxQszgOUyalvUN5CwvAZmko%2FX0lifqQd3ijgc%2FaDExumc2M3Yu%2BBdLYR4Lh6ggIzDBc6FzsL7xs%2BgTM0j5MMUb1cwj8mFkc8bCRTD7aOA8USJXkwuZ8TH7otU%2B5P%2FYKoW1leKvo%3D"}],"group":"cf-nel","max_age":604800}
nel: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
server: cloudflare
cf-ray: 7977c8ef9c508802-SIN
{"id":5,"nic":"A000018","name":"cfInwH udwmcHwa","name_en":"Ahmed Haneef","dob":"1977-08-01T00:00:00.000Z","gender":"M","house_name":"rWTcsuain","house_name_en":"New Star","island_name":"elWm","island_name_en":"Male'","atoll":"k","atoll_en":"K","constituency":"T9","district_en":"Galolhu","block_no":"140","created_at":"2023-02-03T14:12:32.901Z","updated_at":"2023-02-03T14:12:32.901Z"}

View File

@ -1,11 +1,12 @@
#/bin/bash
START_NID=$1
NID=$START_NID
END_NID=$2
FILENAME=A${1}-A${2}.json
while [ "$START_NID" -le "$END_NID" ];
do
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
echo Scraping: $NID # print
CONTENT=$(curl -si https://fikureggedhirun.com/api/fetch?nic=A$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
@ -14,7 +15,8 @@ do
echo $DATA | tee -a $FILENAME
printf "\n" | tee -a $FILENAME
START_NID=$(echo $[$START_NID+1])
sleep 5
printf -v NID "%06d" $START_NID
sleep 1
else
echo delaying
sleep 1000