altmetric / embiggen

A Ruby library to expand shortened URLs
https://rubygems.org/gems/embiggen
MIT License
124 stars 6 forks source link

t.co no longer being expanded #30

Closed jmbmxer closed 5 years ago

jmbmxer commented 7 years ago

I noticed today that t.co links are no longer being expanded.

irb(main):024:0> uri=Embiggen::URI('t.co/WPaJlkl1X6').expand => #<URI::Generic t.co/WPaJlkl1X6>

mudge commented 7 years ago

You need to pass a full URI—including the scheme—to Embiggen::URI (as you would Ruby's standard library URI), e.g.

Embiggen::URI('https://t.co/FphB37nk8J').expand
=> #<URI::HTTPS https://github.com/rust-lang/rust/issues/39916>

Your example still doesn't work if I add https though:

Embiggen::URI('https://t.co/WPaJlkl1X6').expand
Embiggen::BadShortenedURI: following https://t.co/WPaJlkl1X6 did not redirect
from /Users/mudge/.gem/ruby/2.3.1/gems/embiggen-1.2.5/lib/embiggen/uri.rb:44:in `follow'