用curl下載Wupload/Fileserve/Filesonic付費帳號

這三個檔案空間的付費帳號下載方式大同小異, 只差在一開始的login form & login url而已
使用curl下載的重點則在於:

  • --cookie-jar 將登入的cookie保存到硬碟
  • --cookie 將登入cookie資訊回傳給serve
  • -L 重導下載網址
  • -O 看看就好, curl的remote-name 用的是未重導的網址, 猜猜樂時間?




Form field
Value
Filesonic
http://www.filesonic.tw/user/login(*)
email 登入email
password 登入密碼
redirect %2F
Wupload
http://www.wupload.com/account/login
email 登入email
password 登入密碼
redirect %2F
rememberMe 1
Fileserve
http://www.fileserve.com/login.php
loginUserName 登入帳號
loginUserPassword 登入密碼
autoLogin on
recaptcha_response_field

recaptcha_challenge_field

recaptcha_challenge_field

loginFormSubmit Login

* 一般的登入網址是http://www.filesonic.com/user/login
filesonic會依據IP 的地區作重導, 在這裡遇到了一個curl的小問題
使用-L/--location選項時:


-L/--location
...........前略..................
              When  curl follows a redirect and the request is not a plain GET (for example POST or PUT), it
              will do the following request with a GET if the HTTP response was 301, 302,  or  303.  If  the
              response  code  was any other 3xx code, curl will re-send the following request using the same
              unmodified method.
response code in (301, 302, 303)就只會用GET重發request, 就變成沒有登入....,只好把位址改成.tw了


沒有留言:

張貼留言