chrisjrob / sluggle

Simple IRC Searchbot
GNU Lesser General Public License v3.0
0 stars 4 forks source link

TinyURL lookup bug #35

Open chrisjrob opened 8 years ago

chrisjrob commented 8 years ago

Suspected regex issue, but somehow

http://www.autotrader.ca/newsfeatures/20160719/why-do-motorcyclists-do-that/

Is being shortened to

http://www.autotrader.ca/20160719/why-do-motorcyclists-do-that/

before being passed to tinyurl, which then returns:

http://tinyurl.com/hoaemm6 - 404 Not Found.

chrisjrob commented 8 years ago

Frustratingly it seems that I am passing the correct URL to the WWW:Shorten makeashorterlink function. In other words this must be a bug in that.

chrisjrob commented 8 years ago

Tried removing the libwww-shorten-perl package and replacing it with the latest in cpan, but no better.

chrisjrob commented 8 years ago

Replaced tinyurl with my own module, but suffers from the same problem. Basically the module boils down to the following line:

my $resp = $ua->post("http://tinyurl.com/api-create.php", [url => $url, source => "PerlAPI-3.093",]);

And that is returning a $resp->content value of the defunct tinyurl of http://tinyurl.com/hoaemm6.

chrisjrob commented 8 years ago

Tested in curl with:

curl -X POST http://tinyurl.com/api-create.php -F 'url=http://www.autotrader.ca/newsfeatures/20160719/why-do-motorcyclists-do-that/'

And it worked perfectly. The only difference in perl is that we are adding "source", but removing that makes no difference. Nor does changing user agent.