Created
January 9, 2017 17:26
-
-
Save hudsonbrendon/0bae16e950ade94df41d315c8bb6ec44 to your computer and use it in GitHub Desktop.
aliexpress.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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