I want to shorten a share URL I have in my app when users share a shop. I want a methodology or an API that allows me to shorten the URL to make it look clean but with my website's name.
for instance:
longURL: "https://example.com?x=somevalue&y=someothervalues"
Then when I shorten the URL with an API or method it would produce a small URL similar to this: "https://mywebsite.com/shortenedURLcode"
here is my code:
link = URL(string: "https://mywebsitename.com/share/?shop="+concatenate(getKey!,"&title="+shopName.text!.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)!,"&desc="+summary.text!.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)!,"&img="+profileImgURL))
I want to shorten the above link with my website's hostname.
How can I do that?
Here are two options to consider for shortening your URLs:
Bitly API
One option Bitly's API, which will allow you to make requests that return shortened links that fit the above mentioned criteria.
It appears to achieve the result you seek, you must make two requests: one to receive the link with custom domain, and a second to customize the "back half" (See revenant API Documentation in hyperlinked text).
The result of request #2 will contain your fully custom link.
Rebrandly API
The far better option in my opinion is Rebrandly. While I personally don't have any experience using any of Rebrandly's products, I would recommend this option as it has a generous free tier to get you started.
And best of all, the entire shortened link can be formulated in a single request. Will note that what Bitly calls a "back-half" is referred to as the "slashtag" by Rebrandly, but these terms both refer to the exact same thing.
API documentation can be found here.
Related
Is it possible to create a Zap that will look-up URL mentions on Twitter?
Been scratching my head with this one, since simply entering URL into Zapier's Twitter Search field doesn't seem to do the trick.
Is it at all possible? Twitter uses its URL shortening service t.co on all links posted. Might this be a reason for me not being able to find any mentions of my URL even when I post one myself? Twitter's native search function finds URL just fine, but not Zapier.
OK, I think I figured it out.
First, use Twitter's special "url" prefix for URL search:
url:amazon - will find URL with the word “amazon” anywhere within it.
Second, most importantly, it looks like the Twitter account I used for testing got ignored after a couple of same URL posts. So be aware of that too.
I wanted to see if there is a service out there that can dynamically change a URL
Ex. If I wanted someone to go to a landing page like www.handsomeman2015.com/landing2015 and I used a link shortner like bit.ly so I would provide the URL like bit.ly/ag95g and it would direct customers to
But I want to be able to change the URL extension to landing2016, landing2017 etc without changing the web link, is this possible?
Sorry if my question isn't using the correct terminology, as I'm a bit new to this stuff.
Linkredirector is a dynamic URL shortener that lets you change the destination URLs of your links. As long as you register an account you can login and edit your links.
Disclaimer, I work at Linkredirector.
Yourls seems to be an interesting option, if you don't mind installing the service on your own website. Additionally, tiny.cc seems to allow you to change the link through their API.
Given below two links which point to the same page with same content. I'm just trying to give this page the right URL.
I can give it one of the following URLs.
http://www.mywebsite.com/help/topic/2001
or
http://www.mywebsite.com/help?topic=2001
Now, when a search engine sees this, what's the effect on the page's caching by the engine.
Do both link have the same effect or one of them can improvise the caching better.
That depends on the search engine. For example, Google will automatically try to guess if a URL parameter must be treated as a unique webpage, so in your scenario google will guess that the value of url parameter "topic" defines a page. Other search engines may fail on guessing this.
I think its better to use a url with no URL parameters, so its absolutely clear that a url is pointing to a unique page, instead of relying on the guessing ability of a search engine.
Specifically, google gives the ability to webmasters to manually set how a parameter will be treated. https://support.google.com/webmasters/answer/1235687?hl=en
I'm having a hard time finding out where to start with this one. I pull information from an external website and put some of the content on my page. I think I need two things done. 1. A google search that takes the url of the top search given a name of my current object. 2. A way to examine the source of the result and output the information of a tag with a specific class.
To better explain this, I'll create a hypothetical situation: Say I have a website that lists mattresses and gives reviews. Say I want to add other websites reviews and in this website there's a tag like 3.5/5. Then I want to display this review along with a link to the external page. Is there a way to search the site like "site:http://mattressreviewsite/ #matress.name", pull that top url, and then search the source for the string "class='rating'" and display this in my view?
Thanks for any help or guidance. I'm using Rails 3.
You need an HTTP client (httparty, net/http-default) for that and do some parsing to get the required results.
Go study the url patterns of google (as far as I remember it was google.com?q=search_string) and use the http client for requests (get/post). Parse the result (there are many HTML parser gems available too) to get what you need and for any subsequent HTTP requests. And don't forget the 'I am feeling lucky' feature of google which returns only one result.
All the best!
Basically I want to know how many people have tweeted a link to a url, but since there are dozens of link shortener out there I don't see any way to do this without having access to all of their url maps. I found a previous question here but it was over a year old and didn't have any new answers.
So #1, does anyone know of a service/API for doing this?
And #2, can anyone think of a way to accomplish this task other than submitting the long url in question to all the popular link shortening sites?
ps- I'm also open to comments about why this is impossible or impractical.
You could perform a Google search (or the equivalent via API) for any pages that link to your page. This is done with the link: keyword. So if you're trying to figure out how many people link to www.example.com (regardless of whether it's through a link shortner URL), then you would just do a Google search for link:www.example.com.
e.g.: http://www.google.com/search?q=link:www.example.com
Note that this will only find pages that have been indexed, so pages that haven't been crawled, or pages that get crawled infrequently, will not show up in the results until a later date (if at all).
Since all sites have different algorithms for shortening the URLs, and these are different sites that most likely do not share their data with each other, how can you hope to find all of them in a single or small number of queries?
All you can do is brute-force it, and even then this might not be any good if a site is content to create a new value for the same long-form URL (especially if you send a different long-form URL that maps to the same place, like http://www.stackoverflow.com/ rather than http://stackoverflow.com/).
In order to really get this to work, there would have to be a site that ALREADY automatically collects all of this information from every site, which the URL shortening sites voluntarily call. And even if you wrote such a site, that doesn't account for the URL-shortening sites already out there who already have data!
In short, I do not see how this is remotely possible, unless I'm wrong about there being such a database somewhere out there.
So months after asking this question I came across a solution to a similar question, that is how to tell how many times a link has been shared on facebook. The solution, via a simple new API call:
http://graph.facebook.com/http://stackoverflow.com
returns the following json data:
{
"id": "http://stackoverflow.com",
"shares": 1627
}