japetheape / expurrel Goto Github PK
View Code? Open in Web Editor NEWRuby gem that decodes shortened urls efficiently.
Home Page: http://www.jaapvandermeer.com/2010/02/13/expurrel-a-library-to-decode-short-urls-in-ruby
License: MIT License
Ruby gem that decodes shortened urls efficiently.
Home Page: http://www.jaapvandermeer.com/2010/02/13/expurrel-a-library-to-decode-short-urls-in-ruby
License: MIT License
hey awesome gem! super simple and effective.
I couldn't get the add provider method to work, so I ended up adding the ones I needed.
e = Expurrel.PROVIDERS << 'bit.ly'
returns:
undefined method `PROVIDERS' for Expurrel:Class (NoMethodError)
I'm using ruby 1.8.7 (2010-01-10 patchlevel 249) [universal-darwin11.0]
here is the list of providers I added:
on.fb.me
nyt.ms
cot.ag
I'm new to ruby and somewhat new to programming, sorry if this is too basic!
This is indeed two issues.
I could't get the add provider function to work.
=> true
e = Expurrel.PROVIDERS << 'bit.ly'
NoMethodError: undefined method`PROVIDERS' for Expurrel:Class
so i added the providers I needed directly (list at the end)
but here is the real problem:
twitter shortener is t.co
and after adding it started getting errors with domains like:
http://editorial-afriquenord-tunisie.blogspot.com/2011/03/les-objectifs-de-la-revolution.html
so i digged in the code and found that the domain was being isolated and compared with include?, so domains that contained t.co returned true.
so i changed that line from:
if domain.include?(l)
to
if domain == l
and problem solved! you'll probably miss some but at least it's safer.
here's the list of shorteners i added:
f24.my
reut.rs
wp.me
shar.es
shr.tn
t.co
j.mp
tl.gd
j.mp
goo.gl
dlvr.it
on.fb.me
fb.me
nyti.ms
cot.ag
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.