Last active
February 23, 2017 00:23
-
-
Save panchicore/b082ffb76eca84448629 to your computer and use it in GitHub Desktop.
scrap OLX cars from barranquilla and make a notifier to car dealers
This file contains hidden or 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
| from bs4 import BeautifulSoup | |
| import re, requests | |
| headers = {'Accept': '*/*', | |
| 'Accept-Encoding': 'gzip, deflate', | |
| 'Accept-Language': 'es-ES,es;q=0.8,en;q=0.6', | |
| 'Connection': 'keep-alive', | |
| 'Content-Type': 'text/html', | |
| 'Origin': 'http://olx.com.co', | |
| 'Referer': 'http://olx.com.co', | |
| 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36'} | |
| url = "http://atlantico.olx.com.co/nf/autos-cat-378/-sort_datedesc" | |
| r = requests.get(url, headers=headers) | |
| s = BeautifulSoup(r.content) | |
| items = s.find_all('li', class_="item ") | |
| for item in items: | |
| text = item.find("h3").text | |
| link = item.find("a").get("href") | |
| price = item.find("p", class_="items-price").text | |
| price = ''.join(re.findall(r"\d+", price)) | |
| price_type = getattr(item.find("span", class_="price-type"), "text", "-") | |
| date_ = item.find("p", class_="items-date").text.replace(" ", "").replace("\n", "").split(",") | |
| print text, price, price_type, date_[0], date_[1] | |
This file contains hidden or 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
| permuto por vehiculo 5000000 Negociable Hoy 21:29 | |
| Toyota Prado Txl 145000000 Negociable Hoy 21:16 | |
| Masda 323 coupe 4000000 Negociable Hoy 20:57 | |
| vendo ford laser 14000000 - Hoy 20:43 | |
| Chevrolet Luv DMax 30000000 Negociable Hoy 20:42 | |
| Vendo aveo modelo 2010 1.6 15 Negociable Hoy 20:41 | |
| Chevrolet Cobalt 31000000 Negociable Hoy 20:39 | |
| HIUNDAY ACCENT 8300000 Negociable Hoy 20:32 | |
| Aveo emotiom particular 16000000 Negociable Hoy 20:29 | |
| Aveo sedan 2.013 como nuevo.Escucho ofertas 20500000 Negociable Hoy 20:23 | |
| Chevrolet N300 Plus 27000000 - Hoy 20:08 | |
| Renault Clio Full Equipo 1.4 Modelo 2003 Solo Whasaap 11500000 Negociable Hoy 20:05 | |
| Mazda Allegro 2008 1.300cc Excelente estado. 18000000 Negociable Hoy 19:57 | |
| Chevrolet Optra Advance 1.6 20500000 Negociable Hoy 19:54 | |
| Vendo chevrolet optra 1.4 16000000 Negociable Hoy 19:54 | |
| Mazda 323 hermoso de Oportunidad!! 4400000 Negociable Hoy 19:43 | |
| Corsa active 2005 9700000 Negociable Hoy 19:38 | |
| Vendo Hermoso Twingo 12700000 Negociable Hoy 19:34 | |
| SPARK GT Mod. 2011 18500000 Negociable Hoy 19:32 | |
| Vendo hermoso aveo sedan 1.6 15 Negociable Hoy 19:15 | |
| Vendo Vehículo 13000000 Negociable Hoy 19:09 | |
| Mazda 3 1.6 21500000 Negociable Hoy 19:04 | |
| Skoda felicia glxi combi mt 1600cc 5500000 Negociable Hoy 19:02 | |
| Oportunidad!! Mazda 323 nx mod 94 4400000 Negociable Hoy 18:54 | |
| Chevrolet spark Gt 20000000 Negociable Hoy 18:29 | |
| Se vende hermoso renault logan 2013!! Como nuevo!! De oportunidad!! Aprovecha $22.500.000!! 22500000 Negociable Hoy 18:16 | |
| Nissan March 1.6 2013 26000000 Negociable Hoy 18:14 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment