Skip to content

Instantly share code, notes, and snippets.

@Zaur-Lumanov
Created June 7, 2016 16:16
Show Gist options
  • Save Zaur-Lumanov/06bb7a5c294ed9d961b630465c0b7802 to your computer and use it in GitHub Desktop.
Save Zaur-Lumanov/06bb7a5c294ed9d961b630465c0b7802 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"log"
"net/http"
"net/url"
"io/ioutil"
"regexp"
"strings"
)
func main() {
fmt.Println(basicAuth("zYBf"))
}
func basicAuth(s string) string {
resp, err := http.PostForm("http://mediadisk.net/@"+s,
url.Values{"action": {"download"}})
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
log.Fatal(err)
}
str := body
re := regexp.MustCompile(`go\/view(.+)?lang=ru`)
s1 := re.FindString(string(str))
s1 = strings.Replace(s1, "go/view/", "!", -1)
s1 = strings.Replace(s1, "?lang=ru", "", -1)
s1 = "http://mediadisk.net/"+s1
return s1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment