Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

keep2share: fix save with correct filename with paid account #66

Closed
wants to merge 2 commits into from

Conversation

dpeddi
Copy link

@dpeddi dpeddi commented Mar 15, 2016

No description provided.

@Raziel-23
Copy link
Contributor

Your fix doesn't work with such links:

http://k2s.cc/file/4d4fa3125b91a

Can you give an example of such filenames? What filenames you expect, and what filenames you get now?

BTW. May I have a favor? Could you run this script with your login and password for keep2share:

$ ./k2p_api.sh 'login' 'password'
#!/bin/bash

JSON=$(curl -s --data '{"username":"'"$1"'","password":"'"$2"'"}' 'http://keep2share.cc/api/v2/login')
JSON="${JSON:1:${#JSON}-2}"
IFS=':' read -r _ _ _ TOKEN <<< "$JSON"

TOKEN="${TOKEN:1:${#TOKEN}-2}"
JSON=$(curl -s --data '{"auth_token": "'$TOKEN'"}' 'http://keep2share.cc/api/v2/accountInfo')
echo "$JSON"

and give the output of it. I just want to know if in this way I can check if this is a premium account.

@dpeddi
Copy link
Author

dpeddi commented Mar 16, 2016

Ooops, yes I confirm so...

dbg: plowdown: --no-overwrite selected
WARNING: Wrong configuration file permissions. Fix it with: chmod 600
/root/.config/plowshare/plowshare.conf
keep2share: take --auth option from configuration file
Starting download (keep2share): http://k2s.cc/file/4d4fa3125b91a
% Total % Received % Xferd Average Speed Time Time Time
Current
Dload Upload Total Spent Left
Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:--
0
% Total % Received % Xferd Average Speed Time Time Time
Current
Dload Upload Total Spent Left
Speed
100 147 0 94 100 53 282 159 --:--:-- --:--:-- --:--:--
283
dbg: Successfully logged in as eddi@depieri.net member
dbg: storage_set: token' set for modulekeep2share'
dbg: token: 'crih6rsj86h6efclkuv208sfagr1j309'
% Total % Received % Xferd Average Speed Time Time Time
Current
Dload Upload Total Spent Left
Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:--
0
File URL:
http://prx-116.keep2share.cc/a1b6774ed5126/b8f558d57ed3f/da44b83d9a59c?temp_url_sig=7f0451f74acc7b3151a798cf4640b4a0106a926e21a1cb721001e7b883f7e19553297d3c40b56f0954f59118e380ba9f45d6383241d6f467fa1d9482bb6b913b&temp_url_expires=1458315324&id=99997d39ad477&node_id=116&project=moneyplatform&user_id=891559&name=Test+file+5MB.zip
Filename: da44b83d9a59c
% Total % Received % Xferd Average Speed Time Time Time
Current
Dload Upload Total Spent Left
Speed
100 5120k 100 5120k 0 0 324k 0 0:00:15 0:00:15 --:--:--
337k
da44b83d9a59c

On Wed, Mar 16, 2016 at 4:08 PM, Raziel-23 notifications@github.com wrote:

Your fix doesn't work with such links:

http://k2s.cc/file/4d4fa3125b91a

Can you give an example of such filenames? What filenames you expect, and
what filenames you get now?

BTW. May I have a favor? Could you run this script with your login and
password for keep2share:

$ ./k2p_api.sh 'login' 'password'

#!/bin/bash

JSON=$(curl -s --data '{"username":"'"$1"'","password":"'"$2"'"}' 'http://keep2share.cc/api/v2/login')
JSON="${JSON:1:${#JSON}-2}"
IFS=':' read -r _ _ _ TOKEN <<< "$JSON"

TOKEN="${TOKEN:1:${#TOKEN}-2}"
JSON=$(curl -s --data '{"auth_token": "'$TOKEN'"}' 'http://keep2share.cc/api/v2/accountInfo')
echo "$JSON"

and give the output of it. I just want to know if in this way I can check
if this is a premium account.


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#66 (comment)

@dpeddi
Copy link
Author

dpeddi commented Mar 16, 2016

before logging on my profile from a browser
root@proliant:/data/stb/divxxx/bin# sh k2p_api.sh dp**@* *******
{"message":"No allow from this
network","status":"error","code":403,"errorCode":73}
root@proliant:/data/stb/divxxx/bin# sh -x k2p_api.sh dp@
* *******
++ curl -s --data '{"username":"dp
@***_","password":"_****"}'
http://keep2share.cc/api/v2/login
+
JSON='{"status":"success","code":200,"auth_token":"crih6rsj86h6efclkuv208sfagr1j309"}'
+
JSON='"status":"success","code":200,"auth_token":"crih6rsj86h6efclkuv208sfagr1j309"'

  • IFS=:
  • read -r _ _ _ TOKEN
  • TOKEN=crih6rsj86h6efclkuv208sfagr1j309
    ++ curl -s --data '{"auth_token": "crih6rsj86h6efclkuv208sfagr1j309"}'
    http://keep2share.cc/api/v2/accountInfo
  • JSON='{"message":"No allow from this
    network","status":"error","code":403,"errorCode":73}'
  • echo '{"message":"No allow from this
    network","status":"error","code":403,"errorCode":73}'

after logging in from my browser
{"message":"No allow from this
network","status":"error","code":403,"errorCode":73}
root@proliant:/data/stb/divxxx/bin# sh -x k2p_api.sh dp**@* *******
++ curl -s --data '{"username":"dp@
_","password":"_****"}'
http://keep2share.cc/api/v2/login
+
JSON='{"status":"success","code":200,"auth_token":"crih6rsj86h6efclkuv208sfagr1j309"}'
+
JSON='"status":"success","code":200,"auth_token":"crih6rsj86h6efclkuv208sfagr1j309"'

  • IFS=:
  • read -r _ _ _ TOKEN
  • TOKEN=crih6rsj86h6efclkuv208sfagr1j309
    ++ curl -s --data '{"auth_token": "crih6rsj86h6efclkuv208sfagr1j309"}'
    http://keep2share.cc/api/v2/accountInfo
    +
    JSON='{"status":"success","code":200,"available_traffic":21474836480,"account_expires":1460505600}'
  • echo
    '{"status":"success","code":200,"available_traffic":21474836480,"account_expires":1460505600}'
    {"status":"success","code":200,"available_traffic":21474836480,"account_expires":1460505600}

On Wed, Mar 16, 2016 at 4:37 PM, Eddi De Pieri eddi@depieri.net wrote:

Ooops, yes I confirm so...

dbg: plowdown: --no-overwrite selected
WARNING: Wrong configuration file permissions. Fix it with: chmod 600
/root/.config/plowshare/plowshare.conf
keep2share: take --auth option from configuration file
Starting download (keep2share): http://k2s.cc/file/4d4fa3125b91a
% Total % Received % Xferd Average Speed Time Time Time
Current
Dload Upload Total Spent Left
Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:--
0
% Total % Received % Xferd Average Speed Time Time Time
Current
Dload Upload Total Spent Left
Speed
100 147 0 94 100 53 282 159 --:--:-- --:--:-- --:--:--
283
dbg: Successfully logged in as eddi@depieri.net member
dbg: storage_set: token' set for modulekeep2share'
dbg: token: 'crih6rsj86h6efclkuv208sfagr1j309'
% Total % Received % Xferd Average Speed Time Time Time
Current
Dload Upload Total Spent Left
Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:--
0
File URL:
http://prx-116.keep2share.cc/a1b6774ed5126/b8f558d57ed3f/da44b83d9a59c?temp_url_sig=7f0451f74acc7b3151a798cf4640b4a0106a926e21a1cb721001e7b883f7e19553297d3c40b56f0954f59118e380ba9f45d6383241d6f467fa1d9482bb6b913b&temp_url_expires=1458315324&id=99997d39ad477&node_id=116&project=moneyplatform&user_id=891559&name=Test+file+5MB.zip
Filename: da44b83d9a59c
% Total % Received % Xferd Average Speed Time Time Time
Current
Dload Upload Total Spent Left
Speed
100 5120k 100 5120k 0 0 324k 0 0:00:15 0:00:15 --:--:--
337k
da44b83d9a59c

On Wed, Mar 16, 2016 at 4:08 PM, Raziel-23 notifications@github.com
wrote:

Your fix doesn't work with such links:

http://k2s.cc/file/4d4fa3125b91a

Can you give an example of such filenames? What filenames you expect, and
what filenames you get now?

BTW. May I have a favor? Could you run this script with your login and
password for keep2share:

$ ./k2p_api.sh 'login' 'password'

#!/bin/bash

JSON=$(curl -s --data '{"username":"'"$1"'","password":"'"$2"'"}' 'http://keep2share.cc/api/v2/login')
JSON="${JSON:1:${#JSON}-2}"
IFS=':' read -r _ _ _ TOKEN <<< "$JSON"

TOKEN="${TOKEN:1:${#TOKEN}-2}"
JSON=$(curl -s --data '{"auth_token": "'$TOKEN'"}' 'http://keep2share.cc/api/v2/accountInfo')
echo "$JSON"

and give the output of it. I just want to know if in this way I can check
if this is a premium account.


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#66 (comment)

@Raziel-23
Copy link
Contributor

Thank you for testing this script. Just as I thought, for free accounts they aren't set account_expires field, but for premium accounts they do.

Ok back to your problem, can you give me an example of filenames, what filenames you expect?

@dpeddi
Copy link
Author

dpeddi commented Mar 16, 2016

on a browser I get:

  1. Remote Address:
    88.85.73.233:80
    1. Request URL:

      http://prx-116.keep2share.cc/a1b6774ed5126/b8f558d57ed3f/da44b83d9a59c?temp_url_sig=7f0451f74acc7b3151a798cf4640b4a0106a926e21a1cb721001e7b883f7e19553297d3c40b56f0954f59118e380ba9f45d6383241d6f467fa1d9482bb6b913b&temp_url_expires=1458315324&id=99997d39ad477&node_id=116&project=moneyplatform&user_id=891559&name=Test+file+5MB.zip

    2. Request Method:
      GET

    3. Status Code:
      200 OK

    4. Response Headersview source

    5. Accept-Ranges:
      bytes

    6. Connection:
      keep-alive

    7. Content-Disposition:
      attachment; filename="Test file 5MB.zip";
      filename*=UTF-8''Test%20file%205MB.zip

    8. Content-Length:
      5242880

    9. Content-Type:
      application/octet-stream

    10. Date:
      Wed, 16 Mar 2016 16:31:30 GMT

    11. Etag:
      277a797522f04863da321f962d7afd2b

    12. Last-Modified:
      Tue, 26 Jan 2016 07:11:39 GMT

    13. Server:
      nginx/1.4.6 (Ubuntu)

    14. X-Timestamp:
      1453792298.58339

    15. X-Trans-Id:
      txad019369eac04d38a3971-0056e98a62

but on plowdown it seems that the content type isn't text-html, so the
content-disposition fail and don't answer for filename... My intention was
to parse the redirected uri string and parse name=, but perhaps isn't the
correct solution.

On Wed, Mar 16, 2016 at 4:53 PM, Raziel-23 notifications@github.com wrote:

Thank you for testing this script. Just as I thought, for free accounts
they aren't set account_expires field, but for premium accounts they do.

Ok back to your problem, can you give me an example of filenames, what
filenames you expect?


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#66 (comment)

@Raziel-23
Copy link
Contributor

I'm trying to figure out how to get filename from the official keep2share api:
https://github.com/keep2share/api
But it always fails for me with this error message: "Invalid request params". I don't know, I will have to think.

@Raziel-23
Copy link
Contributor

Finally this api worked for me. I will prepare fix based on api.

@Raziel-23
Copy link
Contributor

Please test this version:
Raziel-23@4b94aeb
If it will be working for you then I will push it to the master.

@dpeddi
Copy link
Author

dpeddi commented Mar 16, 2016

It works correctly!

Thank you!

On Wed, Mar 16, 2016 at 7:30 PM, Raziel-23 notifications@github.com wrote:

Please test this version:
Raziel-23/plowshare-modules-legacy@4b94aeb
Raziel-23@4b94aeb
If it will be working for you then I will push it to the master.


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#66 (comment)

@Raziel-23
Copy link
Contributor

It's now in the master branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants