Skip to content

Commit

Permalink
Add stephane plaza scraper
Browse files Browse the repository at this point in the history
  • Loading branch information
Tamara Robichet committed Jun 26, 2018
1 parent 8530ec8 commit f0723ab
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions scraper/src/source/stephane.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { HTMLSource } from '../types/source'

export default class Stephane extends HTMLSource {
public url = 'http://www.stephaneplazaimmobilier-nantesest.com/catalog/result_carto.php?action=update_search&map_polygone=&C_28=Vente&C_28_search=EGAL&C_28_type=UNIQUE&site-agence=&C_65_search=CONTIENT&C_65_type=TEXT&C_65=44+NANTES&C_65_temp=44+NANTES&cfamille_id=&C_33_search=COMPRIS&C_33_type=TEXT&C_33_MIN=&C_33_MAX=&C_30_search=INFERIEUR&C_30_type=NUMBER&C_30=&C_30_format_quick='
public resultSelector = '[data-product-id]'

public resultAttributes = [
{ type: 'name', selector: '.item-products_pieces' },
{ type: 'description', selector: '.item-products_address' },
{ type: 'price', selector: '.item-products_price' },
{ type: 'size', selector: '.item-products_pieces' },
{
type: 'photo',
selector: '.slides-image.webresize',
format($: CheerioStatic, photo: CheerioElement) {
const style = $(photo).attr('style')
let imageUrl = /(background-image: url\(")(.*)("\))/gm.exec(style)[2]
imageUrl = imageUrl.split('../')[1]
return `http://www.stephaneplazaimmobilier-nantesest.com/${imageUrl}`
}
},
{
type: 'link',
format($: CheerioStatic, link: CheerioElement): string {
return `http://www.stephaneplazaimmobilier-nantesest.com${$(link).data('url')}`
}
}
]
}

0 comments on commit f0723ab

Please sign in to comment.