FB Marketplace crawler

This commit is contained in:
Shariar Imtiaz 2024-02-01 13:09:43 +04:00
parent ff9a059a35
commit 8723a732cb
1 changed files with 16 additions and 3 deletions

View File

@ -67,11 +67,24 @@ class FbMarketplaceProducts:
products = [] products = []
for element in product_elements: for element in product_elements:
try:
try: try:
name = element.find_element(By.CSS_SELECTOR, ".x1lliihq.x6ikm8r.x10wlt62.x1n2onr6").text name = element.find_element(By.CSS_SELECTOR, ".x1lliihq.x6ikm8r.x10wlt62.x1n2onr6").text
price = element.find_element(By.CSS_SELECTOR, ".x193iq5w.xeuugli.x13faqbe.x1vvkbs.xlh3980.xvmahel.x1n0sxbx.x1lliihq.x1s928wv.xhkezso.x1gmr53x.x1cpjm7i.x1fgarty.x1943h6x.x4zkp8e.x3x7a5m.x1lkfr7t.x1lbecb7.x1s688f.xzsf02u").text except:
pass
try:
price = element.find_element(By.CSS_SELECTOR, ".x193iq5w.xeuugli.x13faqbe.x1vvkbs.x10flsy6.x1lliihq.x1s928wv.xhkezso.x1gmr53x.x1cpjm7i.x1fgarty.x1943h6x.x1tu3fi.x3x7a5m.x1lkfr7t.x1lbecb7.x1s688f.xzsf02u").text
except:
pass
url = element.find_element(By.TAG_NAME, 'a').get_attribute("href") url = element.find_element(By.TAG_NAME, 'a').get_attribute("href")
try:
city = element.find_element(By.CSS_SELECTOR, ".x1lliihq.x6ikm8r.x10wlt62.x1n2onr6.xlyipyv.xuxw1ft").text city = element.find_element(By.CSS_SELECTOR, ".x1lliihq.x6ikm8r.x10wlt62.x1n2onr6.xlyipyv.xuxw1ft").text
except:
pass
flag = 0 flag = 0
product = [name, price, url, city, flag] product = [name, price, url, city, flag]
products.append(product) products.append(product)