Skip to content

Commit 81cc6f6

Browse files
author
seospace
committed
first
1 parent 1a25775 commit 81cc6f6

26 files changed

Lines changed: 765 additions & 0 deletions

.gitignore

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
*idea
6+
# C extensions
7+
*.so
8+
# Distribution / packaging
9+
.Python
10+
build/
11+
develop-eggs/
12+
dist/
13+
downloads/
14+
eggs/
15+
.eggs/
16+
lib/
17+
lib64/
18+
parts/
19+
sdist/
20+
var/
21+
wheels/
22+
*.egg-info/
23+
.installed.cfg
24+
*.egg
25+
26+
# PyInstaller
27+
# Usually these files are written by a python script from a template
28+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
29+
*.manifest
30+
*.spec
31+
32+
# Installer logs
33+
pip-log.txt
34+
pip-delete-this-directory.txt
35+
36+
# Unit test / coverage reports
37+
htmlcov/
38+
.tox/
39+
.coverage
40+
.coverage.*
41+
.cache
42+
nosetests.xml
43+
coverage.xml
44+
*.cover
45+
.hypothesis/
46+
47+
# Translations
48+
*.mo
49+
*.pot
50+
51+
# Django stuff:
52+
*.log
53+
local_settings.py
54+
55+
# Flask stuff:
56+
instance/
57+
.webassets-cache
58+
59+
# Scrapy stuff:
60+
.scrapy
61+
62+
# Sphinx documentation
63+
docs/_build/
64+
65+
# PyBuilder
66+
target/
67+
68+
# Jupyter Notebook
69+
.ipynb_checkpoints
70+
71+
# pyenv
72+
.python-version
73+
74+
# celery beat schedule file
75+
celerybeat-schedule
76+
77+
# SageMath parsed files
78+
*.sage.py
79+
80+
# Environments
81+
.env
82+
.venv
83+
env/
84+
venv/
85+
ENV/
86+
87+
# Spyder project settings
88+
.spyderproject
89+
.spyproject
90+
91+
# Rope project settings
92+
.ropeproject
93+
94+
# mkdocs documentation
95+
/site
96+
97+
# mypy
98+
.mypy_cache/

README.md

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
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+
![](help/cookiecutter.gif)
19+
20+
2. Paste your new engine into SER /engines/ folder.
21+
3. Run your project:<br>
22+
23+
![](help/ser_startproject.gif)
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+
![](help/consume_firefox.png)
40+
41+
6. In case there are no tasks, you will receive:<br>
42+
43+
![](help/consume_notasks.png)
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+
![](help/edit_engine.gif)
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+
![](help/consume_some_variable.png)
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+
![](help/consumer_redirect.png)
83+
84+
8. Now SER will be redirected to http://google.com:
85+
86+
![](help/ser_verify.gif)
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`

config.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"gsapi_server": {"host": "localhost", "port": 9090}
3+
}

consumers/base/cookiecutter.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"server": "http://gsapi.local:9090",
3+
"engine_name": "example.com",
4+
"engine_type": "Profile-URL",
5+
"description": "",
6+
"dofollow": 1,
7+
"anchor_text": 1,
8+
"creates_own_page": 1,
9+
"uses_pages": 0,
10+
"multiple_posts_per_account": 0,
11+
"link_type": "Profile-URL",
12+
"gsa_engines_directory": "C:\\Program Files (x86)\\GSA Search Engine Ranker\\Engines",
13+
"fixed_url": "example.com"
14+
15+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import os
2+
from shutil import copy
3+
4+
engine_path = os.path.dirname(os.path.abspath(__file__)) + '\\' + '{{ cookiecutter.engine_name }}.ini'
5+
gsa_dir = r"{{ cookiecutter.gsa_engines_directory }}"
6+
7+
copy(engine_path, gsa_dir)
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
[setup]
2+
enabled=1
3+
default checked=0
4+
engine type={{ cookiecutter.engine_type }}
5+
description={{ cookiecutter.description }}
6+
dofollow={{ cookiecutter.dofollow }}
7+
anchor text={{ cookiecutter.anchor_text }}
8+
creates own page={{ cookiecutter.creates_own_page }}
9+
uses pages={{ cookiecutter.uses_pages }}
10+
multiple posts per account={{ cookiecutter.multiple_posts_per_account }}
11+
12+
fixed url=http://{{ cookiecutter.fixed_url }}
13+
14+
;;; API MAIN VARIABLES
15+
[api_url]
16+
type=extract
17+
default={{ cookiecutter.server }}
18+
static=1
19+
20+
[api_link_id]
21+
type=extract
22+
front="link_id":
23+
back=}
24+
static=1
25+
26+
[api_target_url]
27+
type=extract
28+
default=%targeturl%
29+
static=1
30+
31+
;;; API REQUIRED VARIABLES
32+
[api_engine_name]
33+
type=extract
34+
default={{ cookiecutter.engine_name }}
35+
static=1
36+
37+
;;; NORMAL VARIABLES
38+
[URL]
39+
type=url
40+
41+
42+
[STEP1]
43+
link type={{ cookiecutter.engine_type }}
44+
just download=1
45+
46+
submit success="success":true
47+
submit failed="success":false
48+
submit failed retry=XXXXXXXXXXXXXXXXXXXXXXXX
49+
captcha failed=XXXXXXXXXXXXXXXXXXXXXXXX
50+
51+
verify submission=1
52+
verify by=url
53+
verify url=%api_url%/api/link/verify_redirect/%api_link_id%
54+
verify interval=10
55+
verify timeout=99999999999999999999
56+
first verify=5
57+
verify on unknown status=0
58+
59+
[STEP2]
60+
modify url=%api_target_url%
61+
just download=1
62+
63+
[STEP3]
64+
modify url=%api_url%/api/link/create/%api_engine_name%
65+
post data=engine_name=%api_engine_name%&target_url=%api_target_url%&url=%url%
66+
form request with=XMLHttpRequest
67+
encode post data=3
68+
just download=1
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
http://gsapi.local:9090
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"server": "http://gsapi.local:9090",
3+
"engine_name": "example.com",
4+
"engine_type": "Profile-URL",
5+
"description": "",
6+
"dofollow": 1,
7+
"anchor_text": 1,
8+
"creates_own_page": 1,
9+
"uses_pages": 0,
10+
"multiple_posts_per_account": 0,
11+
"link_type": "Profile-URL",
12+
"gsa_engines_directory": "C:\\Program Files (x86)\\GSA Search Engine Ranker\\Engines",
13+
"fixed_url": "example.com"
14+
15+
}
Binary file not shown.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{{ cookiecutter.engine_name }}

0 commit comments

Comments
 (0)