Finding Amazon XPath information [PYTHON]

83 views Asked by At

I have been trying to find the Xpath information for the "customers who viewed this product also viewed" but i cannot seem to get the code correct. I have very little experience with Xpath but i have been using an online scraper to get the info and learn from it.

what ive been doing is

def AmzonParser(url):
    headers = {'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.90 Safari/537.36'}
    page = requests.get(url,headers=headers)
def scraper():    
  While True:
     XPATH_RECOMMENDED = '//a[@id="anonCarousel3"]/ol/li[1]/div/a/div[2] //href'
     RAW_RECOMMENDED = doc.xpath(XPATH_RECOMMENDED)
     RECOMMENDED = ' '.join(RAW_RECOMMENDED).strip() if RAW_RECOMMENDED else None
  

And my main goal is to get the customers also viewed link. so i can pass it to the scraper. This is just a snippet of my code.

0

There are 0 answers