mIRC Home    About    Download    Register    News    Help

Print Thread
#115251 24/03/05 03:24 AM
Joined: Mar 2004
Posts: 540
A
Armada Offline OP
Fjord artisan
OP Offline
Fjord artisan
A
Joined: Mar 2004
Posts: 540
I found an old babelfish script and Im updating it to work with the current altavista site, I have the current urls just dont see why its not working
First off GET /tr?doit=done&tt=urltextlp=de_en&urltext=ich+bin+ein+berliner&url=http%3A%2F%2F works as a url, heres the code, Im thinking its something either with the hash tables or maybe Im just dumb
Code:
 
on *:sockopen:lang:{
  ;  echo -s GET /tr?doit=done&tt=urltext $+ lp= $+ $hget(lang,lang) $+ &urltext= $+ $hget(lang,translate) $+ &url=http%3A%2F%2F HTTP/1.0
  sockwrite -n $sockname GET /tr?doit=done&tt=urltext $+ lp= $+ $hget(lang,lang) $+ &urltext= $+ $hget(lang,translate) $+ &url=http%3A%2F%2F HTTP/1.0
  sockwrite -n $sockname Host: world.altavista.com
  sockwrite -n $sockname Connection: close
  sockwrite -n $sockname $crlf
}
on *:sockread:lang:{
  sockread -f %x
  ;  echo -s %x
  tokenize 32 %x
  if (<form action="http://www.altavista.com/web/results" method=get> == $1-) { hadd lang response $true | return }
  if (($hget(lang,response)) || (<td bgcolor=white* iswm $1-)) {
    echo -a $1-
    echo -a Translation from $replace($hget(lang,language),/,$chr(32) $+ to $+ $chr(32)) $+ :
    echo -a $gettok($hget(lang,language),1,47) $+ : $replace($hget(lang,translate),+,$chr(32))
    echo -a $gettok($hget(lang,language),2,47) $+ : $gettok($1-,2-,62)
    hdel lang response
  }
  unset %x
}
alias lang { if (!$2) { echo $colour(Info) -a * /lang: insufficient parameters | return }
  if ($sock(lang)) sockclose lang
  if ($hget(lang)) { hfree lang }
  hmake lang 10
  hadd lang translate $replace($2-,$chr(32),+)
  hadd lang language $1
  var %' = English/Chinese:en_zh English/French:en_fr English/German:en_de English/Italian:en_it English/Japanese:en_ja English/Korean:en_ko English/Portuguese:en_pt English/Spanish:en_es Chinese/English:zh_en French/English:fr_en French/German:fr_de German/English:de_en German/French:de_fr Italian/English:it_en Japanese/English:ja_en Korean/English:ko_en Portuguese/English:pt_en Russian/English:ru_en Spanish/English:es_en, %" = 1, %"'
  while ($gettok(%',%",32)) {
    if ($1 == $gettok($ifmatch,1,58)) { hadd lang lang $gettok($gettok(%',%",32),2,58) }
    %"' = %"' $gettok($gettok(%',%",32),1,58)
    inc %"
  }
  if (!$hget(lang,lang)) { echo $colour(Info) -a * /lang: invalid language, please use; %"' | return }
  sockopen lang world.altavista.com 80
}


;DOCUMENTATION
;and other little crap
;use /lang <lang1/lang2> <text>
;if you make an invalid language like /lang whatever then it will show you all the languages you can have
;use how u wish, translations provided from altavista.com (babel fish)

;nonexistant
 

#115252 24/03/05 05:22 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Quote:
First off GET /tr?doit=done&tt=urltextlp=de_en&urltext=ich+bin+ein+berliner&url=http%3A%2F%2F works as a url


No it doesnt, well not as you wanted it to at least

http://world.altavista.com/tr?doit=done&...l=http%3A%2F%2F
Now that does tho!

[code]
on *:sockopen:lang:{
; echo -s GET /tr?doit=done&tt=urltext&lp= $+ $hget(lang,lang) $+ &urltext= $+ $hget(lang,translate) $+ &url=http%3A%2F%2F HTTP/1.0
sockwrite -n $sockname GET /tr?doit=done&tt=urltext&lp= $+ $hget(lang,lang) $+ &urltext= $+ $hget(lang,translate) $+ &url=http%3A%2F%2F HTTP/1.0

etc etc

(actually i didnt check anything after this so something else might also be wrong)

#115253 24/03/05 06:02 AM
Joined: Mar 2004
Posts: 540
A
Armada Offline OP
Fjord artisan
OP Offline
Fjord artisan
A
Joined: Mar 2004
Posts: 540
Quote:
<td valign=top><b class=m><font color=#0000000>
Translation from German to English:
German: ich bin ein berliner
English: <b class=m><font color=#0000000

i should be able to get the rest thanks


Link Copied to Clipboard