Skip to content

Instantly share code, notes, and snippets.

@shinderuman
Created March 26, 2020 14:58
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/6621a4d35f8101ea66bf2f51c9b1e90d to your computer and use it in GitHub Desktop.
Save shinderuman/6621a4d35f8101ea66bf2f51c9b1e90d to your computer and use it in GitHub Desktop.
package main
import (
"flag"
"fmt"
"net/http"
"net/url"
"strings"
"github.com/PuerkitoBio/goquery"
"github.com/grokify/html-strip-tags-go"
)
func main() {
flag.Parse()
args := flag.Args()
for _, u := range strings.Split(args[1], "") {
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 := doc.Find("body > div.container > div > div > div > div > div.under_shindantitle_block > div:nth-child(1) > div.result2 > div")
div.Each(func(_ int, s *goquery.Selection) {
h, e := s.Html()
if e != nil {
panic(e)
}
t := strings.Trim(strip.StripTags(h), " \t\r\n")
fmt.Printf("%s\n", t)
})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment