This commit is contained in:
Administrator
2024-09-05 18:16:17 +08:00
parent 688c516c9f
commit 88f37ecc2d
9 changed files with 170 additions and 26 deletions

View File

@@ -162,7 +162,7 @@ func (g *Geziyor) Start() {
g.Opt.StartRequestsFunc(g)
} else {
for _, startURL := range g.Opt.StartURLs {
g.Get(startURL, g.Opt.Encoding, g.Opt.ParseFunc)
g.Get(startURL, g.Opt.ParseFunc)
}
}
@@ -174,8 +174,8 @@ func (g *Geziyor) Start() {
}
// Get issues a GET to the specified URL.
func (g *Geziyor) Get(url, encoding string, callback func(g *Geziyor, r *client.Response)) {
req, err := client.NewRequest("GET", url, encoding, nil)
func (g *Geziyor) Get(url string, callback func(g *Geziyor, r *client.Response)) {
req, err := client.NewRequest("GET", url, g.Opt.Encoding, nil)
if err != nil {
internal.Logger.Printf("Request creating error %v\n", err)
return
@@ -186,8 +186,8 @@ func (g *Geziyor) Get(url, encoding string, callback func(g *Geziyor, r *client.
// GetRendered issues GET request using headless browser
// Opens up a new Chrome instance, makes request, waits for rendering HTML DOM and closed.
// Rendered requests only supported for GET requests.
func (g *Geziyor) GetRendered(url, encoding string, callback func(g *Geziyor, r *client.Response)) {
req, err := client.NewRequest("GET", url, encoding, nil)
func (g *Geziyor) GetRendered(url string, callback func(g *Geziyor, r *client.Response)) {
req, err := client.NewRequest("GET", url, g.Opt.Encoding, nil)
if err != nil {
internal.Logger.Printf("Request creating error %v\n", err)
return
@@ -198,7 +198,7 @@ func (g *Geziyor) GetRendered(url, encoding string, callback func(g *Geziyor, r
// Head issues a HEAD to the specified URL
func (g *Geziyor) Head(url string, callback func(g *Geziyor, r *client.Response)) {
req, err := client.NewRequest("HEAD", url, "", nil)
req, err := client.NewRequest("HEAD", url, g.Opt.Encoding, nil)
if err != nil {
internal.Logger.Printf("Request creating error %v\n", err)
return
@@ -208,7 +208,7 @@ func (g *Geziyor) Head(url string, callback func(g *Geziyor, r *client.Response)
// Post issues a POST to the specified URL
func (g *Geziyor) Post(url string, body io.Reader, callback func(g *Geziyor, r *client.Response)) {
req, err := client.NewRequest("POST", url, "", body)
req, err := client.NewRequest("POST", url, g.Opt.Encoding, body)
if err != nil {
internal.Logger.Printf("Request creating error %v\n", err)
return