mirror of
https://github.com/karust/openserp.git
synced 2026-08-05 16:53:54 +08:00
Readme update
This commit is contained in:
37
README.md
37
README.md
@@ -9,7 +9,7 @@ API access for search engines results if available isn't free.
|
||||
|
||||
Using OpenSERP, you can get search results from **Google**, **Yandex**, **Baidu** via API or CLI!
|
||||
|
||||
See [Docker](#docker) and [CLI](#cli) usage examples below.
|
||||
See [Docker](#docker) and [CLI](#cli) usage examples below ([search](#search), [images](#images)).
|
||||
|
||||
## Docker usage <a name="docker"></a> 🐳
|
||||
* Run API server:
|
||||
@@ -21,13 +21,6 @@ docker run -p 127.0.0.1:7000:7000 -it karust/openserp serve -a 0.0.0.0 -p 7000
|
||||
docker-compose up --build
|
||||
```
|
||||
|
||||
### *Example request*
|
||||
Get 20 **Google** results for `hello world`, only in English:
|
||||
```
|
||||
GET http:/127.0.0.1:7000/google/search?lang=EN&limit=20&text=hello world
|
||||
```
|
||||
You can replace `google` to `yandex` or `baidu` in query to change search engine.
|
||||
|
||||
### Request parameters
|
||||
| Param | Description |
|
||||
|-------|--------------------------------------------------------------|
|
||||
@@ -36,8 +29,34 @@ You can replace `google` to `yandex` or `baidu` in query to change search engine
|
||||
| date | Date in `YYYYMMDD..YYYYMMDD` format (e.g. 20181010..20231010) |
|
||||
| file | File extension to search (e.g. `PDF`, `DOC`) |
|
||||
| site | Search within a specific website |
|
||||
| limit | Limit the number of results |
|
||||
| limit | Limit the number of results
|
||||
|
||||
### **Search**
|
||||
### *Example request*
|
||||
Get 20 **Google** results for `hello world`, only in English:
|
||||
```
|
||||
GET http:/127.0.0.1:7000/google/search?lang=EN&limit=20&text=hello world
|
||||
```
|
||||
You can replace `google` to `yandex` or `baidu` in query to change search engine.
|
||||
|
|
||||
|
||||
### *Example response*
|
||||
```JSON
|
||||
[
|
||||
{
|
||||
"rank": 1,
|
||||
"url": "https://en.wikipedia.org/wiki/%22Hello,_World!%22_program",
|
||||
"title": "\"Hello, World!\" program",
|
||||
"description": "A \"Hello, World!\" program is generally a computer program that ignores any input, and outputs or displays a message similar to \"Hello, World!\"."
|
||||
},
|
||||
]
|
||||
```
|
||||
### **Images**
|
||||
### *Example request*
|
||||
Get 100 **Google** results for `golden puppy`:
|
||||
```
|
||||
GET http://127.0.0.1:7000/google/image?text=golden puppy&limit=100
|
||||
```
|
||||
### *Example response*
|
||||
```JSON
|
||||
[
|
||||
|
||||
@@ -216,7 +216,7 @@ func (gogl *Google) SearchImage(query core.Query) ([]core.SearchResult, error) {
|
||||
continue
|
||||
}
|
||||
|
||||
for i, r := range resultElements[len(searchResultsMap):] {
|
||||
for i, r := range resultElements {
|
||||
// TODO: parse AF_initDataCallback to optimize instead of this?
|
||||
err := r.Click(proto.InputMouseButtonRight, 1)
|
||||
if err != nil {
|
||||
@@ -271,6 +271,8 @@ func (gogl *Google) SearchImage(query core.Query) ([]core.SearchResult, error) {
|
||||
Description: fmt.Sprintf("Height:%v, Width:%v, Source Page: %v", imgSrc.Height, imgSrc.Width, imgSrc.PageURL),
|
||||
}
|
||||
searchResultsMap[*dataID] = gR
|
||||
|
||||
r.Remove()
|
||||
}
|
||||
|
||||
if !gogl.LeavePageOpen {
|
||||
|
||||
Reference in New Issue
Block a user