add keywords json
parent
06f6ee9646
commit
93d715a0f6
File diff suppressed because it is too large
Load Diff
24
scrapper.py
24
scrapper.py
|
@ -12,13 +12,17 @@ import re
|
|||
with open("marketplaces.json", "r", encoding="utf-8") as f:
|
||||
data = json.load(f)
|
||||
|
||||
with open("keywords.json", "r", encoding="utf-8") as f:
|
||||
keywords = json.load(f)
|
||||
|
||||
with open("cookies.json", "r", encoding="utf-8") as f:
|
||||
cookies_ref = json.load(f)
|
||||
|
||||
# Or if it's a Python dict already:
|
||||
marketplaces = data["marketplaces"]
|
||||
|
||||
BASE_PATH= '/mnt/AmazonReports/Amazon/keyword_ranking'
|
||||
#BASE_PATH= '/mnt/AmazonReports/Amazon/keyword_ranking'
|
||||
BASE_PATH= 'data'
|
||||
MAX_PAGE = 10
|
||||
|
||||
|
||||
|
@ -149,14 +153,16 @@ def get_amazon_ranks(url, marketplace, ratingPrefix, keyword, page, count):
|
|||
|
||||
|
||||
driver = get_driver()
|
||||
for marketplace, details in marketplaces.items():
|
||||
url = details['url']
|
||||
ratingPrefix = details['ratingPrefix']
|
||||
count =1
|
||||
for i in range(1, MAX_PAGE):
|
||||
count = get_amazon_ranks(url, marketplace, ratingPrefix, 'comforter navy queen', i, count)
|
||||
if count == -1:
|
||||
break
|
||||
|
||||
for keyword in keywords:
|
||||
for marketplace, details in marketplaces.items():
|
||||
url = details['url']
|
||||
ratingPrefix = details['ratingPrefix']
|
||||
count =1
|
||||
for i in range(1, MAX_PAGE):
|
||||
count = get_amazon_ranks(url, marketplace, ratingPrefix, keyword, i, count)
|
||||
if count == -1:
|
||||
break
|
||||
sleep(3)
|
||||
driver.quit()
|
||||
|
||||
|
|
Loading…
Reference in New Issue