Last active
February 12, 2019 16:41
-
-
Save shinderuman/a8a5de5d26bf0ecda315ea654cc82afa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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