Skip to content

Commit 97eae9b

Browse files
committed
serps features + doyoumean
1 parent fcad58a commit 97eae9b

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

tasks_get.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import time
1111
import datetime
1212
from client import RestClient
13+
import json
1314

1415

1516
if __name__ == '__main__':
@@ -28,7 +29,7 @@
2829
password = conf['general']['password']
2930

3031
# Output headers
31-
fields=['task_id','status','request','request_type','domain','location_code','language_code','timestamp','results_count','rank_group','rank_absolute','result_type','title','description','url','breadcrumb']
32+
fields=['task_id','status','request','request_type','domain','location_code','language_code','timestamp','results_count','spell','item_types','rank_group','rank_absolute','item_type','title','description','url','breadcrumb']
3233
# Output name
3334
timestr = time.strftime("%Y%m%d-%H%M%S")
3435
tag = args.output + "-" + timestr
@@ -58,6 +59,8 @@
5859
results.append(client.get(resultTaskInfo['endpoint_regular']))
5960

6061
for result in results:
62+
print(result)
63+
6164
for task in result["tasks"]:
6265
task_id = task['id']
6366
status = task['status_message']
@@ -69,6 +72,8 @@
6972
language_code = kw["language_code"]
7073
timestamp = kw["datetime"]
7174
results_count = kw["se_results_count"]
75+
spell = json.dumps(kw["spell"])
76+
item_types = json.dumps(kw["item_types"])
7277

7378
for item in kw["items"]:
7479
row = dict()
@@ -80,8 +85,10 @@
8085
row["location_code"] = location_code
8186
row["language_code"] = language_code
8287
row["timestamp"] = timestamp
88+
row["spell"] = spell
89+
row["item_types"] = item_types
8390
row["results_count"] = results_count
84-
row["result_type"] = item["type"]
91+
row["item_type"] = item["type"]
8592
row["rank_group"] = item["rank_group"]
8693
row["rank_absolute"] = item["rank_absolute"]
8794
row["title"] = item["title"]
@@ -93,6 +100,7 @@
93100
writer = csv.DictWriter(file, fieldnames=fields, delimiter=";")
94101
writer.writerow(row)
95102
file.close()
103+
exit(0)
96104

97105
print("Batch done.")
98106
time.sleep(args.delay)

0 commit comments

Comments
 (0)