Created
July 2, 2017 02:44
-
-
Save Khalian/bbe9ea69ad059544b89c3e76d8f4f53b to your computer and use it in GitHub Desktop.
Create Tiny url in cli.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
wget -q -O - \ | |
-U "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.8) Gecko/20071008 Firefox/2.0.0.8" \ | |
--header="Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1" \ | |
--header="Accept-Language: en" \ | |
--header="Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7" \ | |
--referer="http://tinyurl.com/" \ | |
--header="Content-Type: application/x-www-form-urlencoded" \ | |
--post-data="url=$*" \ | |
http://tinyurl.com/create.php \ | |
| sed -n 's/.*\(http:\/\/tinyurl.com\/[a-z0-9][a-z0-9]*\).*/\1/p' \ | |
| uniq |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment