comments
This commit is contained in:
parent
075e283ffd
commit
a0aec8e7e4
8
scrap.sh
8
scrap.sh
@ -4,10 +4,10 @@ END_NID=$2
|
|||||||
FILENAME=A${1}-A${2}.json
|
FILENAME=A${1}-A${2}.json
|
||||||
while [ "$START_NID" -le "$END_NID" ];
|
while [ "$START_NID" -le "$END_NID" ];
|
||||||
do
|
do
|
||||||
echo Scraping: $START_NID
|
echo Scraping: $START_NID # print
|
||||||
CONTENT=$(curl -si https://fikureggedhirun.com/api/fetch?nic=A$START_NID > .cache)
|
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)
|
DATA=$(cat .cache | tail -n1) # get the json data from last line
|
||||||
HTTP_STATUS=$(cat .cache | head -n1 | awk '{print $2}')
|
HTTP_STATUS=$(cat .cache | head -n1 | awk '{print $2}') # get the http code from first line
|
||||||
|
|
||||||
if [ "$HTTP_STATUS" = "200" ]
|
if [ "$HTTP_STATUS" = "200" ]
|
||||||
then
|
then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user