Skip to main content

A Facebook video information scraper by Kehem IT

Project description

A Python package to scrape video and reel information from Facebook. This tool allows you to easily retrieve details such as video title, description, URL, and other metadata associated with Facebook videos or reels.

Features

  • Scrape video data from Facebook videos and reels.
  • Extract video metadata like title, description, views, and more.
  • Simple and easy-to-use Python interface.
  • Supports scraping using direct video URLs.
  • Command-line interface (CLI) for quick usage.

Installation

You can install the package from PyPI using the following command:

pip install fb-video

Requirements

  • Python 3.6 or higher.

  • The requests and beautifulsoup4 libraries (these will be installed automatically during installation).

Usage

You can use the Facebook Video Scraper in two ways: through Python code or via the command line interface (CLI).

Python Code Usage

You can integrate the scraper into your Python project and extract video details by using the following code:

from fb_video import FacebookVideoScraper

# Initialize the scraper
scraper = FacebookVideoScraper()

# Replace with the URL of the Facebook video you want to scrape
url = "https://www.facebook.com/video_url"

# Scrape the video information
info = scraper.get_video_info(url)

# Output the video information
print(info)

The get_video_info() function will return a dictionary with various pieces of metadata related to the video, such as: Title: The title of the video.

  • Description: The description of the video.

  • Video URL: Direct link to the video.

  • Views: The number of views on the video.

  • Upload Date: The date the video was uploaded.

Command Line Interface (CLI)

You can also run the scraper directly from the command line by using the following command:

python fb-video.py --url https://www.facebook.com/video_url

This command will output the video details directly to the console.

Example Output

When you run the scraper, you will get a structured output like this:

{
  "url": "https://www.facebook.com/video_url",
  "duration_ms": 926766,
  "sd": "https://www.facebook.com/sd_downloadable_link",
  "hd": "https://www.facebook.com/hd_downloadable_link",
  "title": "",
  "thumbnail": "https://www.facebook.com/thumbnail_link"
}

Troubleshooting

Error: Invalid URL

Ensure that the URL provided is a valid Facebook video or reel URL. The scraper currently only supports public videos. Double-check the link format (e.g., https://www.facebook.com/video_url) and confirm the video is accessible without restrictions.

Error: Permission Denied

If you're unable to access a video, it may be restricted (e.g., private, friends-only, or region-locked) or require login credentials. This scraper does not support private videos or those needing authentication. Use a public video URL to resolve this issue.

Error: Missing Dependencies

If the package fails to install properly, required dependencies might be missing. Ensure you have Python 3.6+ installed, then run the following command to install necessary libraries:

Contributing

We welcome contributions to the Facebook Video Scraper! To contribute, please follow these steps:

  1. Fork this repository
    Create your own copy of the project by forking it on GitHub.

  2. Clone your fork to your local machine
    Download your forked repository to work on it locally using git clone.

  3. Create a new branch for your feature or bugfix
    Use a descriptive branch name, e.g., git checkout -b feature/add-new-scraper.

  4. Make your changes and commit them
    Implement your updates and commit with clear messages, e.g., git commit -m "Add support for reel scraping".

  5. Push to your fork and submit a pull request
    Push your branch to your forked repository and open a pull request against the main project.

Before submitting, ensure your code passes existing tests. If you're adding new features, please consider including corresponding tests to maintain project quality.

License

This project is licensed under the MIT License. See the LICENSE file for full details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fb_video-0.1.5.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fb_video-0.1.5-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file fb_video-0.1.5.tar.gz.

File metadata

  • Download URL: fb_video-0.1.5.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for fb_video-0.1.5.tar.gz
Algorithm Hash digest
SHA256 c3e6ac2f518d86ed10cefd9c91c684a7b4d1e647b63b0939eb00e830e6fd03fe
MD5 35bea8738c8a4c1f77383a4fe7d41b2d
BLAKE2b-256 f549b5b570e6519622e4ff0a5d9422bff818aaf49d6ac66c20391c4bfed532ce

See more details on using hashes here.

File details

Details for the file fb_video-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: fb_video-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for fb_video-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 eaf780c50b0fd09627660c176c54e11fbc6036a81490d27a37d7b94a70380827
MD5 05dc76b6173093068a20d8ab4b6f6460
BLAKE2b-256 94cc732707cde73bb9970294791ec61cadb7e5f4b694c75ab4ead0e93bb4f3a1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page