forked from Taketheone/amazon_parser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfind_valuable_long_tail_keywords.py
52 lines (39 loc) · 1.8 KB
/
find_valuable_long_tail_keywords.py
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
from amazon_module import amazon_module
keyword_list = [
"dog rope",
"headphone",
]
long_tail_keyword_dict_list = []
print("根据给定的关键词,获取亚马逊搜索框的提示词做为长尾词;")
# 没有登录merchantwords付费账号,默认抓取第一条记录的数字作为搜索量
print("获取长尾词的merchantwords搜索量,亚马逊搜索框下显示的产品数,以及两者的比值;")
print("")
for keyword in keyword_list:
long_tail_keyword_list = amazon_module.keyword_to_long_tail_keyword_list(keyword)
for long_tail_keyword in long_tail_keyword_list:
print(" long tail keyword:", long_tail_keyword)
merchantwords_rank = amazon_module.keyword_to_merchantwords_search_rank(long_tail_keyword)
print(" merchantwords rank:", merchantwords_rank)
amazon_search_results = amazon_module.keyword_to_search_results_num(long_tail_keyword)
print("amazon search results:", amazon_search_results)
ratio = ""
try:
ratio = int(merchantwords_rank)/int(amazon_search_results)
ratio = (ratio*100)
ratio = str(ratio).split(".")[0]
ratio = str(int(ratio)/100)
print(" ratio:", ratio)
except:
pass
long_tail_keyword_dict = {
"long_tail_keyword": long_tail_keyword,
"merchantwords_rank": merchantwords_rank,
"amazon_search_results": amazon_search_results,
"ratio": ratio,
}
long_tail_keyword_dict_list.append(long_tail_keyword_dict)
print(long_tail_keyword_dict_list)
try:
amazon_module.dict_list_to_csv_file(long_tail_keyword_dict_list, "long_tail_keyword_file.csv", "long_tail_keyword_folder")
except:
pass