Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/andeya/surfer
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.
https://github.com/andeya/surfer
client restful-client
Last synced: about 3 hours ago
JSON representation
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.
- Host: GitHub
- URL: https://github.com/andeya/surfer
- Owner: andeya
- License: apache-2.0
- Created: 2015-06-14T22:08:30.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2022-06-26T17:17:59.000Z (over 2 years ago)
- Last Synced: 2024-06-19T21:28:54.604Z (5 months ago)
- Topics: client, restful-client
- Language: Go
- Homepage:
- Size: 1.25 MB
- Stars: 218
- Watchers: 15
- Forks: 63
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Surfer [![GitHub release](https://img.shields.io/github/release/andeya/surfer.svg?style=flat-square)](https://github.com/andeya/surfer/releases) [![report card](https://goreportcard.com/badge/github.com/andeya/surfer?style=flat-square)](http://goreportcard.com/report/andeya/surfer) [![github issues](https://img.shields.io/github/issues/andeya/surfer.svg?style=flat-square)](https://github.com/andeya/surfer/issues?q=is%3Aopen+is%3Aissue) [![github closed issues](https://img.shields.io/github/issues-closed-raw/andeya/surfer.svg?style=flat-square)](https://github.com/andeya/surfer/issues?q=is%3Aissue+is%3Aclosed) [![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg?style=flat-square)](http://godoc.org/github.com/andeya/surfer) [![view Go大数据](https://img.shields.io/badge/官方QQ群-Go大数据(42731170)-27a5ea.svg?style=flat-square)](http://jq.qq.com/?_wv=1027&k=XnGGnc)
Package surfer is a high level concurrency http client.
It has `surf` and` phantom` download engines, highly simulated browser behavior, the function of analog login and so on.[简体中文](https://github.com/andeya/surfer/blob/master/README_ZH.md)
## Features
- Both `surf` and `phantomjs` engines are supported
- Support random User-Agent
- Support cache cookie
- Support http/https## Usage
```
package mainimport (
"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](https://github.com/andeya/surfer/tree/master/example)## License
Surfer is under Apache v2 License. See the [LICENSE](https://github.com/andeya/surfer/raw/master/LICENSE) file for the full license text.