Created
March 26, 2020 14:58
-
-
Save shinderuman/6621a4d35f8101ea66bf2f51c9b1e90d 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" | |
"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