Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

WWW::Babelfish usage problem

by vit (Friar)
on Apr 08, 2011 at 17:53 UTC ( [id://898407]=perlquestion: print w/replies, xml ) Need Help??

vit has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks,
I started using this module on my web srever with "service => 'Yahoo'" and everything was fine until I started being banned after sending say 8-10 translation requests.
Does anybody have such experience? Do they need some registration key or whatever? I use it this way:
use WWW::Babelfish; my $obj = new WWW::Babelfish ( service => 'Yahoo', agent => $user_agent, ); if (defined($obj)) { $text = $obj->translate ( 'source' => 'Dutch', 'destination' => 'English', 'text' => $text, 'delimiter' => "\n\t", ); $text = "Could Not Translate: " . $obj->error if(! defined($text)) } else { $text = "Translation server unavailable" }


Another question is what do I need to be able to use Google as "service"? They do require some key and something else. Could someone share experience.

Replies are listed 'Best First'.
Re: WWW::Babelfish usage problem
by eff_i_g (Curate) on Apr 08, 2011 at 18:26 UTC
    Have a gander at Yahoo's TOS (Terms of Service):
    You agree not to modify the Software in any manner or form, nor to use modified versions of the Software, including (without limitation) for the purpose of obtaining unauthorized access to the Yahoo! Services. You agree not to access the Yahoo! Services by any means other than through the interface that is provided by Yahoo! for use in accessing the Yahoo! Services.
      I think it is irrelevant. I am not using Yahoo search URL.
        Google's TOS delves deeper into what is meant by not-a-Google interface:
        5.3 You agree not to access (or attempt to access) any of the Services by any means other than through the interface that is provided by Google, unless you have been specifically allowed to do so in a separate agreement with Google. You specifically agree not to access (or attempt to access) any of the Services through any automated means (including use of scripts or web crawlers) and shall ensure that you comply with the instructions set out in any robots.txt file present on the Services.
        Some modules that are made to work with web services, like Net::Amazon::EC2, provide options to specify access keys, thus making their use legal.
        WWW::Babelfish ( service => 'Yahoo', ...

        How do you figure that code isn't using the Yahoo service?

        Also, URLs have nothing to do with it.

Re: WWW::Babelfish usage problem
by Khen1950fx (Canon) on Apr 09, 2011 at 16:22 UTC
    To use Google as a service, WebService::Google::Language worked for me.
    #!/usr/bin/perl use strict; use warnings; use WebService::Google::Language; use Data::Dump qw(dump); my $service = WebService::Google::Language->new( referer => 'http://example.com', env_proxy => 0, src => 'nl', dest => 'en', ); my $result = $service->translate("Hallo en tot ziens"); print dump($result);

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://898407]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2024-04-16 05:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found