fix seller listing item parsing
This commit is contained in:
parent
518177fdf2
commit
a34cbb5f71
@ -42,19 +42,22 @@ def seller_listings(seller_name, db):
|
|||||||
#print ("Web Page: ", url)
|
#print ("Web Page: ", url)
|
||||||
|
|
||||||
soup = make_soup(url)
|
soup = make_soup(url)
|
||||||
results = soup.find_all("li", class_="sresult lvresult clearfix li")
|
results = soup.find_all("li", class_="s-item s-item__dsa-on-bottom s-item__pl-on-bottom")
|
||||||
|
|
||||||
for result in results:
|
for result in results:
|
||||||
|
#print(result)
|
||||||
try:
|
try:
|
||||||
rec = {
|
rec = {
|
||||||
'epid': result.a['href'].split("?", 1)[0],
|
'epid': result.a['href'].split("?", 1)[0],
|
||||||
}
|
}
|
||||||
|
|
||||||
#check if listing is allready stored
|
#check if listing is allready stored
|
||||||
if not db.search(Query().epid == rec["epid"]):
|
if not db.search(Query().epid == rec["epid"]):
|
||||||
result_page_added += 1
|
result_page_added += 1
|
||||||
db.insert(rec)
|
db.insert(rec)
|
||||||
except (AttributeError, KeyError) as ex:
|
except (AttributeError, KeyError) as ex:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if (result_page_added == 0):
|
if (result_page_added == 0):
|
||||||
last_result_page = True
|
last_result_page = True
|
||||||
page_counter += 1
|
page_counter += 1
|
||||||
|
Loading…
Reference in New Issue
Block a user