Add xsearch
This commit is contained in:
parent
759ce4a331
commit
e5d11f63aa
3 changed files with 13 additions and 25 deletions
|
@ -1,26 +1,9 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/PuerkitoBio/goquery"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
func cmdMikami(c *cli.Context) error {
|
||||
doc, err := goquery.NewDocument("http://mastodonsearch.jp/cross/?q=三上")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
doc.Find(".post").Each(func(n int, elem *goquery.Selection) {
|
||||
href, ok := elem.Find(".mst_content a").Attr("href")
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
text := elem.Find(".mst_content p").Text()
|
||||
fmt.Println(href)
|
||||
fmt.Println(text)
|
||||
fmt.Println()
|
||||
})
|
||||
return nil
|
||||
return xsearch(c.App.Metadata["xsearch_url"].(string), "三上", c.App.Writer)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue