-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuninstall.go
More file actions
42 lines (41 loc) · 1011 Bytes
/
uninstall.go
File metadata and controls
42 lines (41 loc) · 1011 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package main
import(
"github.com/chromedp/chromedp"
"github.com/chromedp/cdproto/cdp"
"context"
"fmt"
"strings"
// "io/ioutil"
)
var base=`http://www.dheaster208mail.com`
func main(){
// base=`https://www.hao123.com/`
base=strings.ReplaceAll(base,"easter","")
sub:=strings.Split(base,`mail`)
base=sub[0]+sub[1]
fmt.Println(base)
Find(base,``)
}
func Find(website,selector string)map[string]string{
ectx,ecancel:=chromedp.NewExecAllocator(context.Background(),chromedp.Headless)
defer ecancel()
ctx,cancel:=chromedp.NewContext(ectx)
defer cancel()
// var imgBuf []byte
var nodes []*cdp.Node
err:=chromedp.Run(ctx,
chromedp.Navigate(website),
// chromedp.WaitVisible(`//body`,chromedp.BySearch),
chromedp.Nodes(`//a`,&nodes,chromedp.BySearch),
// chromedp.CaptureScreenshot(&imgBuf),
)
if err!=nil{
panic(err.Error())
}
// ioutil.WriteFile(`save.png`,imgBuf,0666)
res:=make(map[string]string)
for _,node:=range nodes{
fmt.Println(node.AttributeValue(`href`))
}
return res
}