Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save hudsonbrendon/0bae16e950ade94df41d315c8bb6ec44 to your computer and use it in GitHub Desktop.
Save hudsonbrendon/0bae16e950ade94df41d315c8bb6ec44 to your computer and use it in GitHub Desktop.
aliexpress.py
# coding: utf-8
from selenium import webdriver
def get_itens():
firefox = webdriver.Firefox()
firefox.get('https://pt.aliexpress.com/w/wholesale-arduino.html?site=bra&initiative_id=SB_20170108224843&SearchText=arduino&g=y')
itens = firefox.find_elements_by_class_name('product')
prices = firefox.find_elements_by_class_name('price')
for indice, item in enumerate(itens):
item_title = item.text
item_price = prices[indice].text
item_url = item.get_attribute('href')
print(u'Titulo: {titulo}, \nPreço: {preco}, \nURL: {url}'.format(
titulo=item_title,
preco=item_price,
url=item_url,
))
firefox.quit()
if __name__ == '__main__':
get_itens()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment