sparrovv / gotr

Not Maintained
6 stars 1 forks source link

panic: runtime error: index out of range #5

Open ku1ik opened 9 years ago

ku1ik commented 9 years ago

Here's what I get when using gotr today:

~ % gotr no en skol
panic: runtime error: index out of range

goroutine 16 [running]:
runtime.panic(0x2ce1c0, 0x4a493c)
  /usr/local/Cellar/go/1.3/libexec/src/pkg/runtime/panic.c:279 +0xf5
github.com/sparrovv/gotr/googletranslate.getTranslation(0xc2082f0000, 0xbb2, 0x0, 0x0)
  /Users/sickill/go/src/github.com/sparrovv/gotr/googletranslate/translate.go:65 +0xea
github.com/sparrovv/gotr/googletranslate.translate(0x364530, 0x2a, 0x7fff5fbff875, 0x2, 0x7fff5fbff878, 0x2, 0x7fff5fbff87b, 0x4, 0x0, 0x0, ...)
  /Users/sickill/go/src/github.com/sparrovv/gotr/googletranslate/translate.go:58 +0x47c
github.com/sparrovv/gotr/googletranslate.Translate(0x7fff5fbff875, 0x2, 0x7fff5fbff878, 0x2, 0x7fff5fbff87b, 0x4, 0x0, 0x0, 0x0, 0x0, ...)
  /Users/sickill/go/src/github.com/sparrovv/gotr/googletranslate/translate.go:29 +0x1a1
github.com/sparrovv/gotr/cli.Run(0xc20807a900, 0x39ee10, 0x1b6)
  /Users/sickill/go/src/github.com/sparrovv/gotr/cli/cli.go:59 +0x70e
main.main()
  /Users/sickill/go/src/github.com/sparrovv/gotr/gotr.go:28 +0x9a

goroutine 19 [finalizer wait]:
runtime.park(0x14650, 0x4a8e90, 0x4a6fe9)
  /usr/local/Cellar/go/1.3/libexec/src/pkg/runtime/proc.c:1369 +0x89
runtime.parkunlock(0x4a8e90, 0x4a6fe9)
  /usr/local/Cellar/go/1.3/libexec/src/pkg/runtime/proc.c:1385 +0x3b
runfinq()
  /usr/local/Cellar/go/1.3/libexec/src/pkg/runtime/mgc0.c:2644 +0xcf
runtime.goexit()
  /usr/local/Cellar/go/1.3/libexec/src/pkg/runtime/proc.c:1445

goroutine 24 [IO wait]:
net.runtime_pollWait(0x5587b8, 0x72, 0x0)
  /private/tmp/go-ux1A/go/src/pkg/runtime/netpoll.goc:146 +0x66
net.(*pollDesc).Wait(0xc208070140, 0x72, 0x0, 0x0)
  /usr/local/Cellar/go/1.3/libexec/src/pkg/net/fd_poll_runtime.go:84 +0x46
net.(*pollDesc).WaitRead(0xc208070140, 0x0, 0x0)
  /usr/local/Cellar/go/1.3/libexec/src/pkg/net/fd_poll_runtime.go:89 +0x42
net.(*netFD).Read(0xc2080700e0, 0xc20821d800, 0x800, 0x800, 0x0, 0x557418, 0x23)
  /usr/local/Cellar/go/1.3/libexec/src/pkg/net/fd_unix.go:232 +0x34c
net.(*conn).Read(0xc20803a028, 0xc20821d800, 0x800, 0x800, 0x0, 0x0, 0x0)
  /usr/local/Cellar/go/1.3/libexec/src/pkg/net/net.go:122 +0xe7
crypto/tls.(*block).readFromUntil(0xc208024c30, 0x5588e0, 0xc20803a028, 0x5, 0x0, 0x0)
  /usr/local/Cellar/go/1.3/libexec/src/pkg/crypto/tls/conn.go:451 +0xd9
crypto/tls.(*Conn).readRecord(0xc208054000, 0x17, 0x0, 0x0)
  /usr/local/Cellar/go/1.3/libexec/src/pkg/crypto/tls/conn.go:536 +0x1ff
crypto/tls.(*Conn).Read(0xc208054000, 0xc208079000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
  /usr/local/Cellar/go/1.3/libexec/src/pkg/crypto/tls/conn.go:901 +0x16a
net/http.noteEOFReader.Read(0x561360, 0xc208054000, 0xc2080401b8, 0xc208079000, 0x1000, 0x1000, 0x4bad40, 0x0, 0x0)
  /usr/local/Cellar/go/1.3/libexec/src/pkg/net/http/transport.go:1203 +0x72
net/http.(*noteEOFReader).Read(0xc208183380, 0xc208079000, 0x1000, 0x1000, 0xc20804c440, 0x0, 0x0)
  <autogenerated>:124 +0xca
bufio.(*Reader).fill(0xc2080049c0)
  /usr/local/Cellar/go/1.3/libexec/src/pkg/bufio/bufio.go:97 +0x1b3
bufio.(*Reader).Peek(0xc2080049c0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0)
  /usr/local/Cellar/go/1.3/libexec/src/pkg/bufio/bufio.go:132 +0x101
net/http.(*persistConn).readLoop(0xc208040160)
  /usr/local/Cellar/go/1.3/libexec/src/pkg/net/http/transport.go:782 +0x95
created by net/http.(*Transport).dialConn
  /usr/local/Cellar/go/1.3/libexec/src/pkg/net/http/transport.go:600 +0x93f

goroutine 17 [syscall]:
runtime.goexit()
  /usr/local/Cellar/go/1.3/libexec/src/pkg/runtime/proc.c:1445

goroutine 25 [select]:
net/http.(*persistConn).writeLoop(0xc208040160)
  /usr/local/Cellar/go/1.3/libexec/src/pkg/net/http/transport.go:885 +0x38f
created by net/http.(*Transport).dialConn
  /usr/local/Cellar/go/1.3/libexec/src/pkg/net/http/transport.go:601 +0x957

goroutine 29 [runnable]:
net/http.(*persistConn).readLoop(0xc20820f3f0)
  /usr/local/Cellar/go/1.3/libexec/src/pkg/net/http/transport.go:868 +0x829
created by net/http.(*Transport).dialConn
  /usr/local/Cellar/go/1.3/libexec/src/pkg/net/http/transport.go:600 +0x93f

goroutine 30 [select]:
net/http.(*persistConn).writeLoop(0xc20820f3f0)
  /usr/local/Cellar/go/1.3/libexec/src/pkg/net/http/transport.go:885 +0x38f
created by net/http.(*Transport).dialConn
  /usr/local/Cellar/go/1.3/libexec/src/pkg/net/http/transport.go:601 +0x957
sparrovv commented 9 years ago

Thanks, I'm also getting this. Looks like google has started filtering out gotr request.

The response from server has Our systems have detected unusual traffic from your computer network. This page checks to see if it&#39;s really you sending the requests, and not a robot. :

> ./gotr en en foo
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head><meta http-equiv="content-type" content="text/html; charset=utf-8"><meta name="viewport" content="initial-scale=1"><title>https://translate.google.com/translate_a/t?client=t&amp;hl=pl&amp;ie=UTF-8&amp;oe=UTF-8&amp;prev=enter&amp;sc=2&amp;sl=en&amp;ssel=0&amp;text=fo
o&amp;tl=en&amp;tsel=0</title></head>
<body style="font-family: arial, sans-serif; background-color: #fff; color: #000; padding:20px; font-size:18px;" onload="e=document.getElementById('captcha');if(e){e.focus();}">
<div style="max-width:400px;">
 <hr noshade size="1" style="color:#ccc; background-color:#ccc;"><br>

  To continue, please type the characters below:<br><br>
  <img src="/sorry/image?id=11856933217056485132&amp;hl=en" border="1" alt="Please enable images"><br><br><form action="CaptchaRedirect" method="get"><input type="hidden" name="continue" value="https://translate.google.com/translate_a/t?client=t&amp;hl=pl&amp;ie=UTF-8&amp
;oe=UTF-8&amp;prev=enter&amp;sc=2&amp;sl=en&amp;ssel=0&amp;text=foo&amp;tl=en&amp;tsel=0"><input type="hidden" name="id" value="11856933217056485132"><input type="text" name="captcha" value="" id="captcha" size="12" style="font-size:16px; padding:3px 0 3px 5px; margin-lef
t:0px;"><input type="submit" name="submit" value="Submit" style="font-size:18px; padding:4px 0;"><br><br><br></form>
  <hr noshade size="1" style="color:#ccc; background-color:#ccc;">

   <div style="font-size:13px;">
    <b>About this page</b><br><br>Our systems have detected unusual traffic from your computer network.  This page checks to see if it&#39;s really you sending the requests, and not a robot.  <a href="#" onclick="document.getElementById('infoDiv').style.display='block';">
Why did this happen?</a><br><br>
    <div id="infoDiv" style="display:none; background-color:#eee; padding:10px; margin:0 0 15px 0; line-height:1.4em;">
     This page appears when Google automatically detects requests coming from your computer network which appear to be in violation of the <a href="//www.google.com/policies/terms/">Terms of Service</a>. The block will expire shortly after those requests stop.  In the mea
ntime, solving the above CAPTCHA will let you continue to use our services.<br><br>This traffic may have been sent by malicious software, a browser plug-in, or a script that sends automated requests.  If you share your network connection, ask your administrator for help &
mdash; a different computer using the same IP address may be responsible.  <a href="//support.google.com/websearch/answer/86640">Learn more</a><br><br>Sometimes you may be asked to solve the CAPTCHA if you are using advanced terms that robots are known to use, or sending
requests very quickly.
    </div>

 IP address: 89.206.152.115<br>Time: 2015-04-08T18:30:52Z<br>URL: https://translate.google.com/translate_a/t?client=t&amp;hl=pl&amp;ie=UTF-8&amp;oe=UTF-8&amp;prev=enter&amp;sc=2&amp;sl=en&amp;ssel=0&amp;text=foo&amp;tl=en&amp;tsel=0<br>
 </div>
</div>
</body>
</html>

panic: runtime error: index out of range

I'll investigate that further.

ku1ik commented 9 years ago

I started getting this error again today.

sparrovv commented 9 years ago

Hmm, looks like google has changed its API response. Will have a look tomorrow how much of pain it's gonna be to fix it.

ku1ik commented 8 years ago

Getting this error again today ;)

sparrovv commented 8 years ago

Damn, on hols for the next couple weeks, so no chance to have a look on it :/

On Mon, Oct 19, 2015 at 11:13 AM, Marcin Kulik notifications@github.com wrote:

Getting this error again today ;)

— Reply to this email directly or view it on GitHub https://github.com/sparrovv/gotr/issues/5#issuecomment-149174450.

Michal

Q: Why is this email five sentences or less? A: http://five.sentenc.es

ku1ik commented 8 years ago

Damn, we're all doomed. No worries, we'll live ;)