Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save edson-github/22b18a7251d35007faee81a21e7d324a to your computer and use it in GitHub Desktop.
Save edson-github/22b18a7251d35007faee81a21e7d324a to your computer and use it in GitHub Desktop.
Web scrape amazon.in TV links
#importing libraries
import selenium
from selenium import webdriver as wb
from selenium.webdriver.support.ui import Select
import pandas as pd
import time
#Opening Chrome browser
wbD=wb.Chrome('chromedriver.exe')
#Opening webpage
wbD.get('https://www.amazon.in/s?bbn=1389396031&rh=n%3A976419031%2Cn%3A%21976420031%2Cn%3A1389375031%2Cn%3A1389396031%2Cn%3A15747864031&dc&fst=as%3Aoff&qid=1596287247&rnid=1389396031&ref=lp_1389396031_nr_n_1')
#Running loop to store the product links in a list
listOflinks =[]
condition =True
while condition:
time.sleep(3)
productInfoList=webD.find_elements_by_class_name('a-size-mini')
for el in productInfoList:
if(el.text !="" and el.text !="Sponsored"):
pp2=el.find_element_by_tag_name('a')
listOflinks.append(pp2.get_property('href'))
try:
wbD.find_element_by_class_name('a-last').find_element_by_tag_name('a').get_property('href')
wbD.find_element_by_class_name('a-last').click()
except:
condition=False
len(listOflinks)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment