Skip to main content

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.

Metadata

Release files for fb-video 0.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fb-video 0.1.6
File Size Uploaded Provenance Actions
fb_video-0.1.6.tar.gz 5.0 kB Without provenance Details for fb_video-0.1.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for fb-video 0.1.6
File Interpreter ABI Platform Actions
fb_video-0.1.6-py3-none-any.whl Python 3 none any Details for fb_video-0.1.6-py3-none-any.whl

Total release size: 10.5 kB

Release files / fb_video-0.1.6.tar.gz

Download URL fb_video-0.1.6.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
452f1959f3fbf47a74b6dfdd21709d2b11afb90f7e83778b8b1cdf621d7e83c1
BLAKE2b-256 checksum
How to use checksums
472d77407ec7f69960cd7b82d0ad72f3da79ea6280cdaf35b18e5ee774bff819
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.1

Release files / fb_video-0.1.6-py3-none-any.whl

Download URL fb_video-0.1.6-py3-none-any.whl
Size 5.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
16139bd085911fc968674afe55a2ab32fdc3efd3ffb172baedb00c515dfcfcbc
BLAKE2b-256 checksum
How to use checksums
2b585bc1c68cc18e770643adca910cc7d98c54c564f5b0b0f372faa6ea60f77b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.1

Security for fb-video 0.1.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page