Files
openserp/README.md

115 lines
3.6 KiB
Markdown
Raw Normal View History

2023-06-24 22:25:43 +03:00
# OpenSERP (Search Engine Results Page)
2025-04-09 02:11:22 +08:00
2023-06-24 22:25:43 +03:00
![OpenSERP](/logo.png)
2023-06-23 04:08:00 +03:00
2023-06-24 22:25:43 +03:00
[![Go Report Card](https://goreportcard.com/badge/github.com/karust/openserp)](https://goreportcard.com/report/github.com/karust/openserp)
[![Go Reference](https://pkg.go.dev/badge/github.com/karust/openserp.svg)](https://pkg.go.dev/github.com/karust/openserp)
2023-06-26 15:30:24 +03:00
[![release](https://img.shields.io/github/release-pre/karust/openserp.svg)](https://github.com/karust/openserp/releases)
2025-04-09 02:11:22 +08:00
2023-06-25 20:39:14 +03:00
<!-- ![Docker Image Size (tag)](https://img.shields.io/docker/image-size/karust/openserp/latest) -->
2025-04-09 02:11:22 +08:00
2023-06-24 22:25:43 +03:00
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!
2023-08-06 15:09:26 +03:00
See [Docker](#docker) and [CLI](#cli) usage examples below ([search](#search), [images](#images)).
2023-06-24 22:25:43 +03:00
2025-04-09 02:11:22 +08:00
## Docker usage <a name="docker"></a> 🐳
- Run API server:
2023-06-23 04:08:00 +03:00
```bash
# Use prebuilt image
docker run -p 127.0.0.1:7000:7000 -it karust/openserp serve -a 0.0.0.0 -p 7000
2023-06-25 20:39:14 +03:00
# Or build one and run using docker-compose.yaml
2023-06-23 04:08:00 +03:00
docker-compose up --build
```
2023-06-24 22:25:43 +03:00
### Request parameters
2025-04-09 02:11:22 +08:00
| Param | Description |
| ------- | ---------------------------------------------------------------------- |
| text | Text to search |
| lang | Search pages in selected language (`EN`, `DE`, `RU`...) |
| 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 |
| answers | Include google answers as negative rank indexes (e.g. `true`, `false`) |
2023-08-06 15:09:26 +03:00
### **Search**
2025-04-09 02:11:22 +08:00
### _Example request_
2023-08-06 15:09:26 +03:00
Get 20 **Google** results for `hello world`, only in English:
2025-04-09 02:11:22 +08:00
2023-08-06 15:09:26 +03:00
```
GET http:/127.0.0.1:7000/google/search?lang=EN&limit=20&text=hello world
```
2025-04-09 02:11:22 +08:00
2023-08-06 15:09:26 +03:00
You can replace `google` to `yandex` or `baidu` in query to change search engine.
2025-04-09 02:11:22 +08:00
|
### _Example response_
2023-06-24 22:25:43 +03:00
2023-08-06 15:09:26 +03:00
```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!\".",
"ad": false
2023-08-06 15:09:26 +03:00
},
]
```
2025-04-09 02:11:22 +08:00
### **Images** **[WIP]**
2025-04-09 02:11:22 +08:00
### _Example request_
2023-08-06 15:09:26 +03:00
Get 100 **Google** results for `golden puppy`:
2025-04-09 02:11:22 +08:00
2023-08-06 15:09:26 +03:00
```
GET http://127.0.0.1:7000/google/image?text=golden puppy&limit=100
```
2023-06-24 22:25:43 +03:00
## CLI <a name="cli"></a> ⌨️
2025-04-09 02:11:22 +08:00
- Use `-h` flag to see commands.
- You can use `serve` command to serve API:
2023-06-23 04:08:00 +03:00
```bash
2025-04-09 02:11:22 +08:00
openserp serve
2023-06-23 04:08:00 +03:00
```
2025-04-09 02:11:22 +08:00
- Or print results in CLI using `search` command:
2023-06-23 04:08:00 +03:00
```bash
2023-06-26 15:30:24 +03:00
openserp search google "how to get banned from google fast" # Change `google` to `yandex` or `baidu`
2023-06-23 04:08:00 +03:00
```
2025-04-09 02:11:22 +08:00
2023-06-23 04:08:00 +03:00
As a result you should get JSON output containting search results:
2025-04-09 02:11:22 +08:00
2023-06-23 04:08:00 +03:00
```json
[
2025-04-09 02:11:22 +08:00
{
"rank": 1,
"url": "https://www.cyberoptik.net/blog/6-sure-fire-ways-to-get-banned-from-google/",
"title": "11 Sure-Fire Ways to Get Banned From Google | CyberOptik",
"description": "How To Get Banned From Google · 1. Cloaking: The Art of Deception · 2. Plagiarism: Because Originality is Overrated · 3. Keyword Stuffing: More is Always Better · 4 ...",
"ad": false
}
2023-06-23 04:08:00 +03:00
]
2025-04-09 02:11:22 +08:00
```
## License
2023-06-24 22:25:43 +03:00
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details
## Bugs + Questions 👾
2025-04-09 02:11:22 +08:00
If you have some issues/bugs/questions, feel free to open an issue.