Guest User

Untitled

a guest
Dec 10th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. elif len(keywords) == 2:
  2. keyword1 = keywords[0]
  3. keyword2 = keywords[1]
  4.  
  5. print("Searching for product...")
  6. keywordLinkFound = False
  7. while keywordLinkFound is False:
  8. html = self.driver.page_source
  9. soup = BeautifulSoup(html, 'lxml')
  10. try:
  11. keywordLink = soup.find('image:title', text=re.compile(keyword1 + keyword2)).text
  12. return keywordLink
  13. except AttributeError:
  14. print("Product not found on site, retrying...")
  15. time.sleep(monitorDelay)
  16. self.driver.refresh()
  17. break
  18.  
  19. <url>
  20. <loc>
  21. https://packershoes.com/products/copy-of-382-packer-x-new-era-new-york-yankee-duck-canvas-1
  22. </loc>
  23. <lastmod>2018-12-06T14:39:37-05:00</lastmod>
  24. <changefreq>daily</changefreq>
  25. <image:image>
  26. <image:title>
  27. NEW ERA JAPAN 59FIFTY NEW YORK YANKEES "DUCK CANVAS"
  28. </image:title>
  29. </image:image>
  30. </url>
Add Comment
Please, Sign In to add comment