what I'm missing here with curl/bash?

189 Views Asked by At

Yo there, I'm trying to use curl to download/upload files to rapidgator.net. But download is the most important task; in the past I've done this easily, but now it is downloading only the front page.

The idea is to load a file with the urls required and then pass it to curl as argument, first I make a cookie file

curl -X POST \
--cookie-jar cookie\
-H "Content-type: application/json" \
-d '{"username":"[email protected]","password":"thepassword"}' \
https://rapidgator.net/api/v2/user/login? > /dev/null

By the api, this should have been right, but it only generates a valid cookie with

https://rapidgator.net/api/v2/user/[email protected]&password=thepassword
 > /dev/null

The reply is conform in the expected way (as documented here ), but it isn't saving to the stated cookie file.

And once the cookie is generated, the filelist is created and the download is made in the next way

for i in $(cat filelist) \ 
      do 
          curl -x -L -O -C - --cookie cookie_file -s "$url/$i" \
done

But it only download the regular front page, so it seems the cookie isn't working. And since there are long lists, doing one by one isn't viable.

So how can generate the cookie and download with curl?

Thanks in advance.

UPDATE
Thanks for the support. The detail is the api itself, since

username

is implemented as

login

once this is updated to generate the cookie the curl download is only adjusted to

  curl -L -O -C - --cookie cookie_file $i \  

Thanks for the support!

0

There are 0 best solutions below