Giter VIP home page Giter VIP logo

eternalvision / sreality.cz-parser Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 1.24 MB

This script scrapes property listings from www.sreality.cz for apartments in Prague. Using libraries like puppeteer for web browsing and cheerio for HTML parsing, it saves the extracted data into a data.json file.

Home Page: https://eternalvision.github.io/Sreality.cz-Parser/

License: MIT License

JavaScript 100.00%
cheerio javascript parser puppeteer

sreality.cz-parser's Introduction

Documentation

Overview

This code is designed to automatically scrape data from the real estate website www.sreality.cz. Using this code, you can extract information about apartments offered for sale in Prague and save them to a file named data.json.

Libraries Used

  • cheerio: Used for parsing and extracting data from HTML.
  • puppeteer: A library for browser automation (e.g., navigating to a page and fetching its content).
  • fs: Node.js module for file system operations.

Functions

getPageHtml(pageNumber)

This asynchronous function is responsible for fetching the web page's content.

  • Arguments:
    • pageNumber: The page number to fetch.
  • Returns: The HTML content of the page or null in case of an error.

scrapeData(pageNumber)

This asynchronous function performs the main task of data extraction and saving.

  • Arguments:
    • pageNumber: The starting page number for data scraping.
  • Actions:
    1. Loads the HTML content of the specified page.
    2. Uses cheerio to parse and extract apartment data.
    3. Checks if the data.json file exists and, if so, loads the existing data.
    4. Appends the new data to the existing data.
    5. Saves the combined data to data.json.
    6. Moves to the next page if the current page isn't the last one.

Execution

The code automatically starts scraping data from the first page upon execution.

Result

After the code completes its execution, all the scraped data will be saved in the data.json file.

sreality.cz-parser's People

Contributors

eternalvision avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.