MCPcopy Index your code
hub / github.com/andeya/surfer

github.com/andeya/surfer @v1.3.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.3.0 ↗ · + Follow
80 symbols 193 edges 17 files 66 documented · 82%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Surfer GitHub release report card github issues github closed issues GoDoc view Go大数据

Package surfer is a high level concurrency http client. It has surf andphantom download engines, highly simulated browser behavior, the function of analog login and so on.

简体中文

Features

  • Both surf and phantomjs engines are supported
  • Support random User-Agent
  • Support cache cookie
  • Support http/https

Usage

package main

import (
    "github.com/andeya/surfer"
    "io/ioutil"
    "log"
)

func main() {
    // Use surf engine
    resp, err := surfer.Download(&surfer.Request{
        Url: "http://github.com/andeya/surfer",
    })
    if err != nil {
        log.Fatal(err)
    }
    b, err := ioutil.ReadAll(resp.Body)
    log.Println(string(b), err)

    // Use phantomjs engine
    surfer.SetPhantomJsFilePath("Path to phantomjs.exe")
    resp, err = surfer.Download(&surfer.Request{
        Url:          "http://github.com/andeya",
        DownloaderID: 1,
    })
    if err != nil {
        log.Fatal(err)
    }
    b, err = ioutil.ReadAll(resp.Body)
    log.Println(string(b), err)

    resp.Body.Close()
    surfer.DestroyJsFiles()
}

Full example

License

Surfer is under Apache v2 License. See the LICENSE file for the full license text.

Extension points exported contracts — how you extend this code

Surfer (Interface)
Surfer represents an core of HTTP web browser for crawler. [2 implementers]
surfer.go

Core symbols most depended-on inside this repo

Download
called by 12
surfer.go
handleError
called by 8
example/example002/example.go
SetPhantomJsFilePath
called by 4
surfer.go
Download
called by 4
surfer.go
createFromDetails
called by 4
agent.go
handleError
called by 4
example/example005/example.go
prepare
called by 3
request.go
ReadBody
called by 3
request.go

Shape

Function 38
Method 22
Struct 15
TypeAlias 3
Interface 2

Languages

Go100%

Modules by API surface

body.go13 symbols
agent.go12 symbols
util.go9 symbols
surf.go9 symbols
phantom.go7 symbols
request.go6 symbols
surfer.go5 symbols
agent_linux_arm.go3 symbols
agent_linux.go3 symbols
example/example005/example.go2 symbols
example/example004/example.go2 symbols
example/example002/example.go2 symbols

For agents

$ claude mcp add surfer \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact