-
-
Notifications
You must be signed in to change notification settings - Fork 844
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
URL shortener #123
Comments
I will look into adding this as a feature to the short tool. What Im thinking is I will take in the link as an argument and first try to find the true link behind the shortened link. If these two links are the same I will assume the user actually wanted to shorten the provided link and then it will make this api request and return the shortened link. Hows that sound? |
Hey, Why not just pass arguments for shortening and expanding.
Or something to that affect. Because, checking if a link will resolve to its actual destination will not always work. Take youtube
I think this is a better approach, thoughts? |
UPDATESince I started the issue, I have made significant changes that improve the overall functionality of ki.tc. Link creation remains the same. However, admin access now includes fingerprinting from fingerprintjs2.
|
Sorry I havent responded in a little, I have just started school and was busy working on cryptowatch Good point about using options I did not account for the possibility of a case like that. When this is implemented that is how it will be done. Can u further explain the use of this admin link? Why would someone want to use this etc |
Hey, So the admin link is used to track or rather log usage. Again, this is a url shortener with logging capabilities. Note, it relies heavily on JS; I used the same method t.co uses in twitter, where the page loads, then redirects. The initial loading part takes advantage of fingerprintjs2. |
Sorry I haven't really done anything with this I spent a few hours trying to implement and ran into some errors with how the quotations needed to be escaped when the command is used within a script. It may take a while (since school has started up again and my open source work has been harder to keep up with) but I am definitely looking to implement this. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Sorry not I've done this yet bot I will do this by the weekend |
So i got everything here to work but the issue seems to be coming from your api, whenver I click on a shortened url all that ends up happening is it decodes the url and adds it to after the ki.tc and gives me a page which says the url was not found ex. short -s google.com
=====================================================================
Original URL: google.com
Shortened URL: http://ki.tc/c697f
===================================================================== Clicking on the shortened url it turn the website into For now I will add this to a dev branch but it will not be added to mainstream until this works, afterwards I will look into adding the admin link |
Hey, The curl argument for creating a shortened link is
it should, and I tested it multiple times, return a functional shortened link
Try it http://ki.tc/fb241 I think you might have shortend Cheers, |
I have run my script verbosely and the curl call looks like this curl -A curl -s -i -H 'Content-Type: application/json' -X POST -d '{"url": "google.com"}' http://ki.tc/ The response looks like this 'HTTP/1.1 201 CREATED
Date: Wed, 08 Nov 2017 20:08:46 GMT
Server: Apache/2.4.18 (Ubuntu)
Content-Length: 237
Content-Type: application/json
{
"url_short": {
"_id": "58ade014577a9190a6da8",
"admin_link": "http://ki.tc/url_shortner/58ade014577a9190a6da8",
"link": "http://ki.tc/20434",
"time": "Wed, 08 Nov 2017 20:08:46 GMT",
"url": "google.com"
}
}' Going to the link The link you provided to check works, not sure why this issue is occurring when I do it from my script |
Ahaaaa, figured it out. you're posting |
Ah fair enough, let me know when this is good to go and I will make sure it will be ready to go in my script for the next release 😄 |
Hey, Fixed!! I opted for adding a url validator(Thanks to your indirect bug report).
and
I could have added a regex that simply checks if Anyway, if this quick fix is something you could work with thumbs-up, if not...let me know.. Cheers, |
I implemented shortening the url by checking to see if the user enters http:// or https:// in the beginning and if not I prepend it. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
And if I add Here is what I didvitalkanev@vitalkanev-HP-Artful:~$ short -s https://<some some some some url>.xyz
'=====================================================================
Original URL: https://
Shortened URL:
====================================================================='
vitalkanev@vitalkanev-HP-Artful:~$ short -s http://example.com
'=====================================================================
Original URL: http://
Shortened URL:
====================================================================='
vitalkanev@vitalkanev-HP-Artful:~$ short -v
Version 1.20.0 |
@vitalkanev can you run one of those as |
HTTPS outputvitalkanev@vitalkanev-HP-Artful:~/clones$ bash -x short -s https://<...>.xyz
+ currentVersion=1.20.0
+ configuredClient=
+ configuredPython=
++ uname
+ [[ Linux != \D\a\r\w\i\n ]]
++ uname
+ [[ Linux != \D\a\r\w\i\n ]]
+ getConfiguredPython
+ command -v python2
+ command -v python
+ configuredPython=python
+ getConfiguredClient
+ command -v curl
+ configuredClient=curl
+ getopts e:s:uvh opt
+ case "$opt" in
+ shorten=true
+ inputURL=https://<...>.xyz
+ getopts e:s:uvh opt
+ [[ '' == \t\r\u\e ]]
+ [[ 2 == 0 ]]
+ [[ 2 == \1 ]]
+ [[ '' == \t\r\u\e ]]
+ [[ true == \t\r\u\e ]]
+ [[ curl != \c\u\r\l ]]
+ checkInternet
+ httpGet github.com
+ shortenURL https://<...>.xyz
++ echo https://<...>.xyz
++ grep -Eo '^[h]ttp[s]?://'
+ newURL=https://
+ [[ https:// == '' ]]
++ curl -A curl -s -i -H 'Content-Type: application/json' -X POST -d '{"url": "https://"}' http://ki.tc/
+ response='HTTP/1.1 400 BAD REQUEST
Date: Tue, 05 Dec 2017 12:21:53 GMT
Server: Apache/2.4.18 (Ubuntu)
Content-Length: 115
Connection: close
Content-Type: application/json
{
"error": "malformed url: \"https://\". url must start with a scheme specifier(http://, https://, ftp://...)"
}'
++ echo HTTP/1.1 400 BAD $'REQUEST\r' Date: Tue, 05 Dec 2017 12:21:53 $'GMT\r' S' Content-Length: $'115\r' Connection: $'close\r' Content-Type: $'application/json\r' $'\r' '{' '"error":' '"malformed' url: '\"https://\".' url must start with a scheme 'specifier(http://,' https://, 'ftp://...)"' '}'
++ tail -n 1
++ grep -Eo 'http://ki.tc/[0-9a-zA-Z]*'
+ returnedURL=
+ printShortenedResults
+ cat
'=====================================================================
Original URL: https://
Shortened URL:
=====================================================================' HTTP outputvitalkanev@vitalkanev-HP-Artful:~/clones$ bash -x short -s http://example.com
+ currentVersion=1.20.0
+ configuredClient=
+ configuredPython=
++ uname
+ [[ Linux != \D\a\r\w\i\n ]]
++ uname
+ [[ Linux != \D\a\r\w\i\n ]]
+ getConfiguredPython
+ command -v python2
+ command -v python
+ configuredPython=python
+ getConfiguredClient
+ command -v curl
+ configuredClient=curl
+ getopts e:s:uvh opt
+ case "$opt" in
+ shorten=true
+ inputURL=http://example.com
+ getopts e:s:uvh opt
+ [[ '' == \t\r\u\e ]]
+ [[ 2 == 0 ]]
+ [[ 2 == \1 ]]
+ [[ '' == \t\r\u\e ]]
+ [[ true == \t\r\u\e ]]
+ [[ curl != \c\u\r\l ]]
+ checkInternet
+ httpGet github.com
+ shortenURL http://example.com
++ echo http://example.com
++ grep -Eo '^[h]ttp[s]?://'
+ newURL=http://
+ [[ http:// == '' ]]
++ curl -A curl -s -i -H 'Content-Type: application/json' -X POST -d '{"url": "http://"}' http://ki.tc/
+ response='HTTP/1.1 400 BAD REQUEST
Date: Tue, 05 Dec 2017 12:26:03 GMT
Server: Apache/2.4.18 (Ubuntu)
Content-Length: 114
Connection: close
Content-Type: application/json
{
"error": "malformed url: \"http://\". url must start with a scheme specifier(http://, https://, ftp://...)"
}'
++ echo HTTP/1.1 400 BAD $'REQUEST\r' Date: Tue, 05 Dec 2017 12:26:03 $'GMT\r' S' Content-Length: $'114\r' Connection: $'close\r' Content-Type: $'application/json\r' $'\r' '{' '"error":' '"malformed' url: '\"http://\".' url must start with a scheme 'specifier(http://,' https://, 'ftp://...)"' '}'
++ tail -n 1
++ grep -Eo 'http://ki.tc/[0-9a-zA-Z]*'
+ returnedURL=
+ printShortenedResults
+ cat
=====================================================================
Original URL: http://
Shortened URL:
===================================================================== |
Hey, It seems that for some reason it's passing an empty url
if I am not mistaken, Line 150 in 47e91be
and if it actually finds one, it assigns only the specifier Line 151 in 47e91be
Also, this whole thing was due to the addition of a validation function from my part on ki.tc. It only accepts correct scheme specifiers. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically closed because it has been inactive for 30 days. |
I fixed the url shortener, I am having success expanding urls such as tiny urls but I cannot expand urls that were shortened by your api it just returns a destination identical to the source |
Hey, the shortening url feature relies heavily on js, in fact it's dependent on it. After all it is a fingerprinting api. The url expansion api is a simple redirect follower; it wont follow redirects from the shortening api because there won't be any redirects unless js is detected. It's a shortcoming from my part, not adding non-js redirects for the shortening api. I will amend it however; in the meantime, curl any shortened url from ki.tc, you'll see the js dump. |
Issue Label:
Description:
I have created a url shortener at ki.tc. I made it with CLI in mind.
Example Usage:
Create a link:
Response:
Admin Access:
Response:
Admin access updated(after someone visits the link). Updated with every Access attempt.
Delete Link(DELETE METHOD | admin link)
Response:
After finishing, I realised that I spelled shortener wrong
shortner
. Will stick with it. 😢If its a bug make sure to include this section.
OS and OS version:
OS Version:
The text was updated successfully, but these errors were encountered: