Экспортировать позиции домена для своих ключевых слов (export_positions_csv)
export_positions_csv — метод экспортирует позиции домена в csv файл.
Пример ответа |
||||||||||||
Domain | Keywords | Position | Position Changes | The number of queries | CPC | Competition in PPC | Keyword length | URL | Types of keywords | Results found | Keywords (broad match) | Approximate traffic |
allo.ua | zz b | 51 | -2 | 10 | 0 | 0 | 2 | https://allo.ua/ru/duhovye-shkafy/zanussi-zzb-510401-b.html | kn_graph_disambiguation | 181000000 | 0 | 0 |
allo.ua | zylo sony ericsson | 18 | 9 | 10 | 0 | 0 | 3 | https://allo.ua/ru/products/mobile/sony-ericsson-w20-zylo-silver.html | pic,related_search,video | 543000 | 0 | 0 |
allo.ua | zxperia z5 | 2 | 720 | 0.0218107 | 100 | 2 | https://allo.ua/ru/products/mobile/sony-xperia-z5-dual-e6633-green.html | shopping_rhs,related_search | 43400000 | 0 | 698 | |
allo.ua | zx310 | 5 | 10 | 0.0615423 | 100 | 1 | https://allo.ua/ru/naushniki/sony-mdr-zx310-black.html | related_search,pic | 722000 | 0 | 5 | |
allo.ua | zx220bt sony | 4 | 10 | 0 | 0 | 2 | https://allo.ua/ru/naushniki/bluetooth-sony-mdr-zx220bt-black.html | pic,related_search,video | 128000 | 0 | 8 | |
allo.ua | zx1 compact | 4 | 0 | 30 | 0.068738 | 39 | 2 | https://allo.ua/ru/products/mobile/sony-xperia-xz1-compact-g8441-black.html | pic,snip_reviews_stars | 314000 | 0 | 25 |
allo.ua | zx premium sony | 1 | 10 | 0 | 0 | 3 | https://allo.ua/ru/products/mobile/sony-xperia-xz-premium-deepsea-black.html | pic,snip_reviews_stars | 37000000 | 0 | 10 |
http://api.serpstat.com/v3/export_positions_csv?query=example.com&token=XXX&se=XXX
import codecs
import json
import pprint
import urllib.request as urlrequest
from urllib.parse import urlencode
host = 'http://api.serpstat.com/v3'
method = 'export_positions_csv'
params = {
'query': 'example.com',
'se': 'g_us',
'token': 'ijmiom4f5m34905g03um8342dm04923lre3w'}
api_url = "{host}/{method}?{params}".format(
host=host,
method=method,
params=urlencode(params, safe=',')
)
try:
csv_data = urlrequest.urlopen(api_url).read()
except Exception as e0:
print("API request error: {error}".format(error=e0))
codecs.open('csv_data.csv', mode='w', encoding='utf8').write(csv_data.decode('utf8'))