Skip to content

renting real estate scrappers#52

Open
jdesi22 wants to merge 11 commits intomainfrom
instance-support
Open

renting real estate scrappers#52
jdesi22 wants to merge 11 commits intomainfrom
instance-support

Conversation

@jdesi22
Copy link
Copy Markdown
Collaborator

@jdesi22 jdesi22 commented Mar 1, 2026

  • adapted timeout
  • added real estate scrappers for renting instead of buying

@jdesi22 jdesi22 requested a review from frediramos March 1, 2026 13:24
Copy link
Copy Markdown
Collaborator

@frediramos frediramos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alguns scrapers não funcionarem bem. Mais detalhes em baixo.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Estive a verificar e parece-me haver um problema de carregamento do site.
Não de execução do scrapper. Se correres a versão de compra do casasapo, o mesmo problema ocorre.
Acho que o problema é só deixar o site carregar?
Não sei se é viável forçar um wait até que o site carregue nestes scrapers?

Captura de ecrã 2026-03-05 165321 Captura de ecrã 2026-03-05 165331

Copy link
Copy Markdown
Collaborator

@frediramos frediramos Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Não sei se é viável forçar um wait até que o site carregue nestes scrapers?

Parece-me uma boa ideia.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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):
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Funcionou bem parece-me :)

@frediramos
Copy link
Copy Markdown
Collaborator

PS: Já que este scrapers 'herdam' dos originais do real estate, talvez faça sentido verificar se têm os mesmos erros.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants