in reply to Unshortening t.co links
"Can anyone point me toward resources for unshortening t.co links in Perl? WWW::Shorten doesn't include it.
It does, the makealongerlink method, illustrated in the Synopsis
Update: disregard the above.
#!/usr/bin/perl use strict; use warnings; use LWP::UserAgent; use feature 'say'; my $url = 'https://t.co/O4qjsxuCsV'; # pretend to be a proper browser my $uaname = 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 ( + KHTML, like Gecko) Chrome/40.0.2214.93 Safari/537.36'; my $ua = LWP::UserAgent->new; $ua->agent( $uaname ); my $resp = $ua->get($url); say $resp->header('title');
returns:
https://www.malaysia-chronicle.com/?p=225241
|
|---|