How to build shortlinks with python on Mac — TinyUrls make your long url shorter.
Here’s a quick tutorial on how to build shortlinks with python on Mac. Also, you could consider this a how to make tinylinks using python 2.7. This all started because I was learning about web scraping.
BTW: Don’t split because this says a language you haven’t head of before…
Making Tinyurl’s in an automated environment — Python!
Making Tinyurl’s in an automated environment is easy if you use python, below I’m going to link you around, and show you how you can start using python for free, no funnel, no sign-ups, and you get to make a link like this: http://tinyurl.com/yb45lpsl. Test it for yourself, it will drive you to my personal domain, http://tylergarrett.com.
So, check this out… Trying to learn python from scratch is a lot of fun, appears to be a bit of a ramp up to being decent too, but that’s why I’m blogging about it every day. Learning how to install python seems to be critical for the future of my career…
You might be thinking, “tyler im going to make shit loads of the same tinyurl for my service page and rank it to the f#$cken moon.”
You get one tinyURL per unique URL. To learn more about other shortlink services, here’s a top 5 list.
Making Tinylinks with python 2.7, easy peezy.
After playing around with python, I ran across something interesting, and if you know about SEO, you know that putting links on keywords you want to rank for, like my name, Tyler Garrett… The link inside of the name, Tyler Garrett, is a Tiny url, from Tinyurl.com.
Here’s the example. 2 lines of code, and you get a shortlink in return. Beautiful, I used to spin my wheels making short links. This is stupid easy.
5 lines of total code….
First we will want to make sure we install tinyurl’s pip.
python -m pip install tinyurl --user
Now, if you’re on a mac, your 2.7 python will the tiny url pip available.
Now you can turn on python.
Type python
Now you should see the 2.7 version start, you maybe wondering, why not version 3.7… Well, it didn’t work.
Alright, so that’s why I’m saying type python
and not python3
With python running in your terminal, let’s start with the import.
import tinyurl
tinyurl.create_one('http://tylergarrett.com')
And poof.
Now, if you’re like me, you’re probably thinking, time to make a bunch of short links, hehe. Shortlinks like this, count towards you increasing your domain ranking with Google. Google tracks short links towards SEO power.
Other shortlink services are Bit.ly, Ow.ly, and now consider legacy Goo.gl.
I have access to Goo.gl (until april 2019), bitly and owly are free,…
…
….but now with this, I feel there’s no reason to use any other service unless it’s this easy. Excited to build another app to insert a list of links, and output a bunch of tinyurls.
Automation of tinyurls is easy with python, I’m in love.
Blogged again on linkedin.