forked from r4sas/PBinCLI
add tinyurl support
Signed-off-by: r4sas <r4sas@i2pmail.org>
This commit is contained in:
parent
b596f42b7e
commit
92c38344e3
@ -136,11 +136,17 @@ class Shortener:
|
|||||||
PBinCLIError("YOURLS: No status, statusCode or message fields in response! Received:\n{}".format(response))
|
PBinCLIError("YOURLS: No status, statusCode or message fields in response! Received:\n{}".format(response))
|
||||||
|
|
||||||
elif self.api == 'clckru':
|
elif self.api == 'clckru':
|
||||||
# from urllib.parse import quote_plus
|
|
||||||
request = {'url': url}
|
request = {'url': url}
|
||||||
|
|
||||||
result = self.session.post(
|
result = self.session.post(
|
||||||
url = "https://clck.ru/--",
|
url = "https://clck.ru/--",
|
||||||
proxies = self.proxy,
|
proxies = self.proxy,
|
||||||
data = request)
|
data = request)
|
||||||
print("Short Link:\t{}".format(result.text))
|
print("Short Link:\t{}".format(result.text))
|
||||||
|
|
||||||
|
elif self.api == 'tinyurl':
|
||||||
|
request = {'url': url}
|
||||||
|
result = self.session.post(
|
||||||
|
url = "https://tinyurl.com/api-create.php",
|
||||||
|
proxies = self.proxy,
|
||||||
|
data = request)
|
||||||
|
print("Short Link:\t{}".format(result.text))
|
||||||
|
@ -38,7 +38,7 @@ def main():
|
|||||||
choices=["zlib", "none"], help="set compression for paste (default: zlib). Note: works only on v2 paste format")
|
choices=["zlib", "none"], help="set compression for paste (default: zlib). Note: works only on v2 paste format")
|
||||||
# URL shortener
|
# URL shortener
|
||||||
send_parser.add_argument("-S", "--short", default=False, action="store_true", help="use URL shortener")
|
send_parser.add_argument("-S", "--short", default=False, action="store_true", help="use URL shortener")
|
||||||
send_parser.add_argument("--short-api", default=argparse.SUPPRESS, action="store", choices=["clckru", "yourls"], help="API used by shortener service")
|
send_parser.add_argument("--short-api", default=argparse.SUPPRESS, action="store", choices=["clckru", "tinyurl", "yourls"], help="API used by shortener service")
|
||||||
send_parser.add_argument("--short-url", default=argparse.SUPPRESS, help="URL of shortener service API")
|
send_parser.add_argument("--short-url", default=argparse.SUPPRESS, help="URL of shortener service API")
|
||||||
send_parser.add_argument("--short-user", default=argparse.SUPPRESS, help="Shortener username")
|
send_parser.add_argument("--short-user", default=argparse.SUPPRESS, help="Shortener username")
|
||||||
send_parser.add_argument("--short-pass", default=argparse.SUPPRESS, help="Shortener password")
|
send_parser.add_argument("--short-pass", default=argparse.SUPPRESS, help="Shortener password")
|
||||||
|
Loading…
Reference in New Issue
Block a user