Closed muralikodali closed 5 years ago
Shortening for sending, receiving, or both?
On 15 September 2019 11:52:58 AM IST, R4SAS notifications@github.com wrote:
Shortening for sending, receiving, or both?
It will be a neat feature, if we get lengthy URL shortened ( shown in the terminal and copied to clipboard) before we send it to others. Not for receiving URLs. YOURLS with with an API and secret is convenient for this. -- Regards, Murali Kodali
Latest commit adds support of URL shorteners, but currently I checked it only with clck.ru service. Please check it with YOURLS.
New switches for send command:
-S, --short use URL shortener
--short-api {clckru,yourls}
API used by shortener service
--short-url SHORT_URL
URL of shortener service API
--short-user SHORT_USER
Shortener username
--short-pass SHORT_PASS
Shortener password
--short-token SHORT_TOKEN
Shortener token
That options also can be provided in config: https://github.com/r4sas/PBinCLI/blob/432675f2e6ea935c047b73b33c402bca8e12003a/pbincli/cli.py#L81-L85
Test output:
$ pbincli send -d -S --short-api clckru -t "test!"
Set paste version to 1
Password: b'WLJpQMxG4QDdcQ5e7O8AY1FVDeaQf5Oyp8jzpOnmDSs='
Passphrase: WLJpQMxG4QDdcQ5e7O8AY1FVDeaQf5Oyp8jzpOnmDSs=
Request: {'opendiscussion': 0, 'data': b'{"adata":"","cipher":"aes","iv":"ZL8kb5vkTfUhBnyI1kUx7g==","v":1,"ts":128,"ks":128,"salt":"SKTSF9zYfog=","mode":"gcm","ct":"ybN9lHL6icU6GRtrPr49GLJhgFv7sXMYaEc/HA==","iter":10000}', 'expire': '1day', 'burnafterreading': 0, 'formatter': 'plaintext'}
Response: {'url': '/?c42b4e37d00fcc6e', 'status': 0, 'deletetoken': '98f047414d402d5ccc668ef17e9a865a26aef226db71319449229be5cb263726', 'id': 'c42b4e37d00fcc6e'}
Paste uploaded!
PasteID: c42b4e37d00fcc6e
Password: WLJpQMxG4QDdcQ5e7O8AY1FVDeaQf5Oyp8jzpOnmDSs=
Delete token: 98f047414d402d5ccc668ef17e9a865a26aef226db71319449229be5cb263726
Link: https://paste.i2pd.xyz/?c42b4e37d00fcc6e#WLJpQMxG4QDdcQ5e7O8AY1FVDeaQf5Oyp8jzpOnmDSs=
Short Link: https://clck.ru/J98sF
with yourls , output is given under:
Traceback (most recent call last):
File "/home/murali/.pyenv/versions/3.6.0/bin/pbincli", line 11, in
After giving back full length of url, output shows like this: Traceback (most recent call last):
File "/home/murali/.pyenv/versions/3.6.0/bin/pbincli", line 11, in
Please try again with latest commit.
with any of parameters (username and password or secret token) output is: PBinCLI Error: YOURLS: No status, code and message fields in response! Received: along with json output showing keyword: "shorturl" shorturl:"full length url" and status code: 200
with all parameters of login given on commandline (username,password,secret token) output is: PBinCLI Error: YOURLS: either username and password or token are required. Otherwise set to default (None).
@muralikodali can you send me to email r4sas@i2pd.xyz access info to your "yourls" instance with temporary user?
@muralikodali thank you for providing credentials, now all must work as expected.
Will write ASAP documentation about YOURLS shortener support.
idk, maybe make required only path to shortener without yourls-api.php
part (just check and add it when initializing Shortener class)?
Thank you very much. It is now working nice.
Privatebin provides urlshortener buttion. When configured with self hosted server like yourls , it will be very convenient to send urls ( as privatebin urls are very lengthy ). I request you to provide a commandline option for url shortening.