Esempio n. 1
0
	def scrape_advert(self, uri, advert=None):
		print('Scraping Gumtree advert: ' + uri)
		page = urllib2.urlopen(uri)
		advert_html = BeautifulSoup(page)
		advert = Advert(uri) if advert is None else advert
		advert.title = self._extract_title(advert_html)
		advert.price = self._extract_price(advert_html)
		advert.location = self._extract_location(advert_html)
		advert.location_coordinates = self._extract_location_coordinates(advert_html)
		advert.room_type = self._extract_room_type(advert_html)
		advert.date_available = self._extract_date_available(advert_html)
		advert.property_type = self._extract_property_type(advert_html)
		advert.seller_type = self._extract_seller_type(advert_html)
		advert.phone_number = self._extract_phone_number(advert_html)
		advert.description = self._extract_description(advert_html)
		advert.photos = self._extract_photos(advert_html)
		return advert