- Código:
#!/usr/bin/perl -w
# By MMxM
use strict;
use WWW::Mechanize;
our $RTTAppID;
my $mech = WWW::Mechanize->new();
$mech->get( 'http://www.bing.com/translator/' );
if($mech->content() =~ /Default.Constants.RTTAppID = '(.*)'/){
$RTTAppID = $1;
} else {
print "[-] Error\n";
exit(1);
}
print "[*] Texto para traduzir: ";
my $texto = <>;
$texto =~ s/ /+/gi;
chomp($texto);
my $url = ( "http://api.microsofttranslator.com/v2/ajax.svc/TranslateArray2?appId=\"$RTTAppID\"&texts=[\"".$texto."\"]&from=\"\"&to=\"pt\"&oncomplete=_mstc1&onerror=_mste1" );
$mech->get( $url );
if($mech->content =~ /"TranslatedText":"(.*?)"/) { print "[Tradução] $1\n"; }
Participe do fórum, é rápido e fácil