This week I am planning to create URL shortener client.
Plan :
– Collect Information how URL shortener work.
One could say
f( some long url) = shortened URL
very good link to follow to understand how URL Shortener is :
http://en.wikipedia.org/wiki/URL_shortening
http://www.quora.com/How-does-a-URL-shortener-work
– Look for the design and implementation for URL Shortener.
google is providing list of api on various language:
https://developers.google.com/url-shortener/libraries
https://developers.google.com/apis-explorer/#p/urlshortener/v1/
I collected the sample application on python form the google page.
TODO : I found one page to read, it is related to Authentication.
– Choose a suitable language to start working ( possibly python/C).
I started with python as I mentioned that I got sample application from google page. It makes things too easy.
Here I am posting the code to call the URLShortener api.
67 def list(items):
68 print ‘-‘*100;
69 for item in items:
70 print ‘%-90s %-3d’% (item[‘longUrl’], int(item[‘analytics’][‘allTime’][‘shortUrlClicks’]))
71 #print type(item[‘analytics’][‘allTime’][‘shortUrlClicks’])
72 print ‘-‘*100;
86 # Create an httplib2.Http object to handle our HTTP requests and authorize it
87 # with our good Credentials.
88 http = httplib2.Http()
89 http = credentials.authorize(http)
90
91 # Construct the service object for the interacting with the URL Shortener API.
92 service = discovery.build(‘urlshortener’, ‘v1′, http=http)
93
94 try:
95 print “Success! Now add code here.”
96 url = service.url()
97 resp = url.list(projection=’FULL’).execute()
98 items = resp[‘items’]
99 list(items)
100
101 except client.AccessTokenRefreshError:
102 print (“The credentials have been revoked or expired, please re-run”
103 “the application to re-authorize”)
104
Here, I called the URLShortener api and collected the all the list of shortened URL, (one good thing I found on the api is that I could count clicks on my click).
Code can be grabbed at github.
-Integrate with mobile application (IOS/Android).
The same api is for number of language. Now I am thinking to move to use this api for the objectiveC.
At the same time I found the things for them I am curious :
– Using Curl, to call the rest api using C.
– Go language, I would like to go and read this language.
-Think of creating MAC Desktop Application ( this is yes/no question.).
Here week has ended. So this hack was “incomplete”.
Completion – 30%
backlogs –
Writing an iOS application for URL shortening (I will try to meet this backlog next weekend).
You really make cod ghosts prestige hack seem so easy with your presentation but I in finding this topic
actually one thing which I I would by no means understand.
It seems too complicated and very huge for me.
I’m having a look forward on your subsequent Publish ,
I’ll try to cling of it!
Fastidious respond in return of this query with solid arguments
and explaining the whole thing on the topic of that.