Skip to content

Instantly share code, notes, and snippets.

@shinderuman
Last active February 12, 2019 16:41
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 shinderuman/a8a5de5d26bf0ecda315ea654cc82afa to your computer and use it in GitHub Desktop.
Save shinderuman/a8a5de5d26bf0ecda315ea654cc82afa to your computer and use it in GitHub Desktop.
package main
import "flag"
import "fmt"
import "net/http"
import "net/url"
import "os"
import "strings"
import "github.com/PuerkitoBio/goquery"
func main() {
flag.Parse()
args := flag.Args()
w := ""
for _, u := range strings.Split(args[1], "") {
w = w + u
resp, e := http.PostForm(
"https://shindanmaker.com/"+args[0],
url.Values{"u": {u}},
)
if e != nil {
panic(e)
}
doc, e := goquery.NewDocumentFromResponse(resp)
if e != nil {
panic(e)
}
div := doc.Find("body > div.container > div > div > div > div > div.under_shindantitle_block > div.result2 > div")
div.Each(func(_ int, s *goquery.Selection) {
h, e := s.Html()
if e != nil {
panic(e)
}
mamemo := strings.Trim(h, " \t\r\n")
fmt.Printf("%s: %s\n", mamemo, w)
if mamemo == "まめももんが" {
os.Exit(0)
}
})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment