Skip to content

Commit

Permalink
Readthedocs update
Browse files Browse the repository at this point in the history
  • Loading branch information
fauxir committed Sep 12, 2024
1 parent d14d7db commit b06a080
Show file tree
Hide file tree
Showing 7 changed files with 203 additions and 1 deletion.
File renamed without changes.
61 changes: 61 additions & 0 deletions docs/api_reference.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
API Reference
=============

This section provides detailed information about the functions available in ScrapeBnB.

getFromRoomUrl
--------------

Fetches detailed information about a specific Airbnb listing.

- **Parameters**:
- ``roomURL`` (string): The full URL of the Airbnb listing.
- ``currency`` (string): The currency code (e.g., 'USD', 'EUR').
- ``checkIn`` (string): Check-in date in 'YYYY-MM-DD' format.
- ``checkOut`` (string): Check-out date in 'YYYY-MM-DD' format.
- ``proxyUrl`` (string, optional): Proxy URL if you're using one.

- **Returns**: A Promise that resolves with the listing details.

Example:

.. code-block:: javascript
const details = await airbnbScraper.getFromRoomUrl(
'https://www.airbnb.com/rooms/12345678',
'USD',
'2024-09-01',
'2024-09-07'
);
getFromRoomId
-------------

Fetches detailed information about a specific Airbnb listing using the room ID.

- **Parameters**:
- ``roomId`` (string): The Airbnb room ID.
- ``currency`` (string): The currency code (e.g., 'USD', 'EUR').
- ``checkIn`` (string): Check-in date in 'YYYY-MM-DD' format.
- ``checkOut`` (string): Check-out date in 'YYYY-MM-DD' format.
- ``proxyUrl`` (string, optional): Proxy URL if you're using one.

- **Returns**: A Promise that resolves with the listing details.

searchAll
---------

Performs a search and returns all results for a given area and date range.

- **Parameters**:
- ``checkIn`` (string): Check-in date in 'YYYY-MM-DD' format.
- ``checkOut`` (string): Check-out date in 'YYYY-MM-DD' format.
- ``neLat`` (number): Northeast latitude of the area.
- ``neLong`` (number): Northeast longitude of the area.
- ``swLat`` (number): Southwest latitude of the area.
- ``swLong`` (number): Southwest longitude of the area.
- ``zoomValue`` (number): Zoom level for the search.
- ``currency`` (string): The currency code (e.g., 'USD', 'EUR').
- ``proxyUrl`` (string, optional): Proxy URL if you're using one.

- **Returns**: A Promise that resolves with the search results.
50 changes: 50 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# conf.py - Sphinx configuration file for ScrapeBnB documentation

import os
import sys

# Add the project root directory to the Python path for autodoc
sys.path.insert(0, os.path.abspath('../'))

# Project information
project = 'ScrapeBnB'
author = 'Michael Adrian'
copyright = '2024, Michael Adrian'
release = '1.1.1'

# General configuration
extensions = [
'sphinx.ext.autodoc', # Automatically document from docstrings
'sphinx.ext.napoleon', # Support for Google style docstrings
'sphinx.ext.viewcode', # Add links to source code
'sphinx.ext.todo', # Support for TODOs
]

# Templates path
templates_path = ['_templates']

# Exclude patterns for files
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']

# HTML output configuration
html_theme = 'alabaster' # You can choose another theme if you prefer
html_static_path = ['_static']

# Options for autodoc
autodoc_member_order = 'bysource'

# Napoleon settings for Google and NumPy style docstrings
napoleon_google_docstring = True
napoleon_numpy_docstring = False

# Enable TODOs (you can remove this if you don't plan to use TODOs in the docs)
todo_include_todos = True

# Custom sidebar configuration (optional, for alabaster theme)
html_sidebars = {
'**': [
'about.html',
'navigation.html',
'searchbox.html',
]
}
12 changes: 12 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Welcome to ScrapeBnB's documentation!
=====================================

Contents:

.. toctree::
:maxdepth: 2
:caption: Table of Contents

introduction
installation_usage
api_reference
62 changes: 62 additions & 0 deletions docs/installation_usage.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
Installation & Usage
====================

This section covers how to install and use **ScrapeBnB** in your Node.js project.

Installation
------------

To install **ScrapeBnB**, use the following command:

.. code-block:: bash
npm install scrapebnb
Ensure you have Node.js installed. ScrapeBnB requires Node.js version 12 or higher.

Usage
-----

Once installed, you can import the ScrapeBnB package in your JavaScript file and start scraping Airbnb data.

Basic Example
-------------

.. code-block:: javascript
const airbnbScraper = require('scrapebnb');
async function getListingDetails() {
try {
const details = await airbnbScraper.getFromRoomUrl(
'https://www.airbnb.com/rooms/12345678',
'USD',
'2024-09-01',
'2024-09-07'
);
console.log(details);
} catch (error) {
console.error('Error fetching listing details:', error);
}
}
getListingDetails();
Proxy Usage
-----------

If you're using a proxy to avoid rate limiting or IP blocking, you can pass the proxy URL as an argument to the scraping functions.

.. code-block:: javascript
const proxyUrl = 'http://your-proxy-url.com';
const details = await airbnbScraper.getFromRoomUrl(
'https://www.airbnb.com/rooms/12345678',
'USD',
'2024-09-01',
'2024-09-07',
proxyUrl
);
Note: Always comply with Airbnb's terms of service when scraping their website.
17 changes: 17 additions & 0 deletions docs/introduction.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
ScrapeBnB
=========

**ScrapeBnB** is a powerful and easy-to-use Node.js package designed for scraping Airbnb property data. It allows you to extract detailed information such as listings, prices, and search results with just a few function calls.

Features
--------

- Fetch detailed listing information by URL or Room ID.
- Perform area searches and get all results with specified filters.
- Get pricing details for Airbnb listings.
- Includes support for proxies to avoid IP blocking.

Why ScrapeBnB?
--------------

If you're building analytics tools, market research, or just curious about Airbnb data, ScrapeBnB simplifies the task. Whether you're a developer or a data enthusiast, this tool is designed to be intuitive and efficient.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "scrapebnb",
"version": "1.1.0",
"version": "1.1.1",
"description": "A Node.js package for scraping Airbnb property data",
"repository": {
"type": "git",
Expand Down

0 comments on commit b06a080

Please sign in to comment.