|
| 1 | +# gsapi |
| 2 | + |
| 3 | +Simple HTTP server for [GSA Search Engine Ranker](https://search-engine-ranker.gsa-online.de/). |
| 4 | +<br> It makes possible to integrate 3rd party tools or custom coded scripts instead of using [script-manual](https://docu.gsa-online.de/search_engine_ranker/script_manual) . |
| 5 | + |
| 6 | +Created mainly to integrate [ZennoPoster](http://www.zennolab.com/en/products/zennoposter/pid/29985796-8d87-4518-babb-7dfa3c58eb10) templates. |
| 7 | + |
| 8 | +## How to install: |
| 9 | +1. Download and install [Python 3.6.3+](https://www.python.org/downloads/) |
| 10 | +2. Download repo and run `install.py` |
| 11 | +3. Run `gsapi_server.py` |
| 12 | +4. Add to your C:\Windows\System32\drivers\etc\hosts file this line: |
| 13 | +- `127.0.0.1 gsapi.local` |
| 14 | + |
| 15 | +## How does it work? |
| 16 | +1. Create your new engine, using cookiecutter, lets call this engine "example.com":<br> |
| 17 | + |
| 18 | + |
| 19 | + |
| 20 | +2. Paste your new engine into SER /engines/ folder. |
| 21 | +3. Run your project:<br> |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | +4. You have script that will create link for you (for example Zennoposter) |
| 26 | +5. To know if there's a pending task to create a link, your script will requests endpoint: |
| 27 | +- http://gsapi.local:9090/api/link/consume/example.com |
| 28 | + |
| 29 | +``` |
| 30 | +{ |
| 31 | + "results": { |
| 32 | + "data": "{\"engine_name\": \"example.com\", \"target_url\": \"http://example.com\", \"url\": \"http://google.com\"}", |
| 33 | + "link_id": 1 |
| 34 | + }, |
| 35 | + "success": true |
| 36 | +} |
| 37 | +``` |
| 38 | + |
| 39 | + |
| 40 | + |
| 41 | +6. In case there are no tasks, you will receive:<br> |
| 42 | + |
| 43 | + |
| 44 | + |
| 45 | +``` |
| 46 | +{ |
| 47 | + "results": "No tasks for example.com", |
| 48 | + "success": false |
| 49 | +} |
| 50 | +``` |
| 51 | +6. In case you need an article, or something else, just edit your example.com.ini file:<br> |
| 52 | + |
| 53 | + |
| 54 | + |
| 55 | +That's what your consumer will see: |
| 56 | + |
| 57 | +``` |
| 58 | +{ |
| 59 | + "results": { |
| 60 | + "data": "{\"engine_name\": \"example.com\", \"target_url\": \"http://example.com\", \"url\": \"http://google.com\", \"some_variable\": \"some data\"}", |
| 61 | + "link_id": 2 |
| 62 | + }, |
| 63 | + "success": true |
| 64 | +} |
| 65 | +``` |
| 66 | + |
| 67 | + |
| 68 | + |
| 69 | +7. After your script (for example Zennoposter template) builds a link, you just simply have to tell gsapi location of the link: |
| 70 | +- for example, if your `link_id is 2` and the url where SER can find url for project is `http:/google.com`, you have to [urlencode](https://www.w3schools.com/tags/ref_urlencode.asp) your link, and send HTTP GET requests to this endpoint: |
| 71 | +- http://gsapi.local:9090/api/link/set_redirect/2/http%3A%2F%2Fgoogle.com |
| 72 | +``` |
| 73 | +{ |
| 74 | + "results": { |
| 75 | + "data": "{\"engine_name\": \"example.com\", \"target_url\": \"http://example.com\", \"url\": \"http://google.com\", \"some_variable\": \"some data\"}", |
| 76 | + "link_id": 2 |
| 77 | + }, |
| 78 | + "success": true |
| 79 | +} |
| 80 | +``` |
| 81 | + |
| 82 | + |
| 83 | + |
| 84 | +8. Now SER will be redirected to http://google.com: |
| 85 | + |
| 86 | + |
| 87 | + |
| 88 | +9. In case your script (ZennoPoster template) get's wrong (ex. your internet connection is down, BAD END), you can set the link_id to "not working", so it can be consumed again, simply call this endpoint: |
| 89 | +- http://gsapi.local:9090/api/link/set_not_working/1 |
| 90 | + |
| 91 | +```` |
| 92 | +{ |
| 93 | + "results": { |
| 94 | + "data": "{\"engine_name\": \"example.com\", \"target_url\": \"http://example.com\", \"url\": \"http://google.com\"}", |
| 95 | + "link_id": 1 |
| 96 | + }, |
| 97 | + "success": true |
| 98 | +} |
| 99 | +```` |
| 100 | + |
| 101 | + |
| 102 | +# helpfull commands and tools: |
| 103 | +- [cmder](http://cmder.net/) |
| 104 | +- `cd .. && rm -r example.com && cookiecutter . && cd example.com && python paste_into_gsa.py` |
0 commit comments