Skip to content

Instantly share code, notes, and snippets.

@nemosupremo
Created January 9, 2015 01:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nemosupremo/501fb7e520999342560a to your computer and use it in GitHub Desktop.
Save nemosupremo/501fb7e520999342560a to your computer and use it in GitHub Desktop.
package main
import (
//"compress/gzip"
"fmt"
//_ "github.com/SlyMarbo/spdy"
"io/ioutil"
"net/http"
"strings"
)
func main() {
h := "http://www.google.com"
u := h + "?part=id&id=ZKfj0-ygXbg%2C8SINiaqgNIQ%2CxeQhXEJaHRo%2CU2VHAMOP5DY%2CGMr1JhKms5M%2CyKjYj5HMaNU%2CJgFAaxNc-tk%2CoMnDCxiZVMw%2Ck4VG725R4X0%2CU-s10nNV_N0%2CkN-p51dFYrk%2CmmIFr0NgRi8%2C4uuQ-qxjqbU%2CuRaePS8fjQE%2CJt_G6a4g9lw%2C5GaFxfjdfX8%2CoKoDg2aG-z4%2CrArN_38Xil8%2C -RuZqxSiFIw%2CNBvTI73iNDo%2CDaRvvkud9MQ%2CZm4y67kxpBk%2CG9MQIHE4pd0%2C2YwKlqgCdQw%2C6pc67X22kFo%2CYvxGDTawvAI%2CgpdFKiMGrDA%2CVEqtKfXYX6A%2ClqQCJ-xCEBE%2CmW8WwnqTmDA%2CZ0W_4kN8isA%2C3i8icj_wJGM%2C0i6E8FPecGc%2Cw8ISxSwSz-0%2CGx2ahhyKqEU%2CrFsJdFKsJDU%2C9ET_qEJYEew%2CVdXBiVM6hyI%2CefL0fPMZGCo%2CHH1OMx7dhhk%2ClvCd9zjXeZE%2CIJ0uQjwTc8o%2CMqoReZ6WJjU%2C0UkWtQGzdXc%2CIZjgPfWX8Jc%2CGvnULl2TRlw%2C6UNXAoOt-zk%2CQDaDKoGV-YA%2CX253vC7vvb8%2Cc-MWDL4C8PY&maxResults=50&"
for i := 280; ; i++ {
req, _ := http.NewRequest("GET", u[:i], nil)
//req.Header.Add("User-Agent", "(gzip)")
resp, _ := http.DefaultClient.Do(req)
if resp == nil || resp.Body == nil {
fmt.Println("Resp nil")
break
}
/*if resp.Header.Get("Content-Encoding") == "gzip" {
resp.Body, _ = gzip.NewReader(resp.Body)
}*/
ioutil.ReadAll(resp.Body)
resp.Body.Close()
fmt.Println(resp.StatusCode)
fmt.Printf("%d\n", len(u[:i]))
fmt.Printf("%d\n", len(strings.Replace(u[:i], h, "", 1)))
if resp.StatusCode != 200 {
//fmt.Printf("%s\n", string(a))
break
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment