-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkeyword-rank-checker.py
More file actions
38 lines (33 loc) · 1.43 KB
/
keyword-rank-checker.py
File metadata and controls
38 lines (33 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import requests
import os
#گرفتن api از استک
api_key = "d79876d2ae3c32771c1d4f06dab9aaf6"
query = input("enter your keyword here: ")
target_domain = input("enter your domain here: ")
google_domain = "google.com"
country_code = "US"
language = "fa"
results = 50
device = "mobile"
#درست کردن پارامترهای api
params = {
'access_key': api_key,
'device': device,
'gl': country_code,
'hl': language,
'auto_location': '1',
'google_domain':google_domain,
'query': query,
'num': results
}
# صدا زدن api
api_result = requests.get('http://api.serpstack.com/search', params)
api_response = api_result.json()
#نشون دادن سایتها در کنسول
for number, result in enumerate(api_response['organic_results'], start=1):
if target_domain in result['domain']:
print("↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓")
print("%s. %s - %s" % (number, result['domain'], result['title']))
print("↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑")
else:
print("%s. %s - %s" % (number, result['domain'], result['title']))