Conversation
jdesi22
commented
Mar 1, 2026
- adapted timeout
- added real estate scrappers for renting instead of buying
There was a problem hiding this comment.
Este scraper não me pareceu funcionar bem.
Obtive isto quando corri:
> python3 -m webscraper run casasapo-rent
Info: Running webscraper
Info: mode: run
Info: website: casasapo-rent
Info: database: /home/ramos/webcap/src/databases/webscraper.db
Info: Entering Page: https://www.casa.sapo.pt/alugar-apartamentos/distrito.Lisboa/
Warning: Could not extract any listing url from the following page: 'https://www.casa.sapo.pt/alugar-apartamentos/distrito.Lisboa/'
Info: Data saved to data.json
There was a problem hiding this comment.
There was a problem hiding this comment.
Não sei se é viável forçar um wait até que o site carregue nestes scrapers?
Parece-me uma boa ideia.
There was a problem hiding this comment.
O scraper do imovirtual inicialmente tinha um problema que eu corrigi por aproveitei para adicionarma funcionalidade.
Em todo o caso, podes ver o fix aqui e dar tua passagem.
(O fallback estava ter um None na location)
| def extract_bathrooms(self, webcap: WebCap, **kwargs) -> int | None: | ||
| extracted = webcap.fetch("#X6", XPATHS["bathrooms"]) | ||
| if extracted: | ||
| return self._clean_bathrooms(extracted) |
There was a problem hiding this comment.
Está a chegar uma lista com o valor [1, 1] ao _clean_bathrooms em vez de uma string.
Se conseguires corrigir melhor. Se não podes usar o novo decorator @cleaner:
@cleaner
def _clean_bathrooms(self, desc: str, warning=True):
O decorator faz com que seja retornado None e uma mensagem de warning é logged.
| } | ||
|
|
||
|
|
||
| class Supercasa(RealEstate): |
There was a problem hiding this comment.
Funcionou bem parece-me :)
|
PS: Já que este scrapers 'herdam' dos originais do real estate, talvez faça sentido verificar se têm os mesmos erros. |
7917a23 to
d2cd979
Compare
(Just for clarity, since we have quite a few now)
dict_flatten -> list_flatten
(To build_dataclass)
ffb5f57 to
32ea738
Compare

