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:
-
Fork this repository
Create your own copy of the project by forking it on GitHub. -
Clone your fork to your local machine
Download your forked repository to work on it locally usinggit clone. -
Create a new branch for your feature or bugfix
Use a descriptive branch name, e.g.,git checkout -b feature/add-new-scraper. -
Make your changes and commit them
Implement your updates and commit with clear messages, e.g.,git commit -m "Add support for reel scraping". -
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fb_video-0.1.4.tar.gz.
File metadata
- Download URL: fb_video-0.1.4.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
faa2fda078def4733cdbb40b5b140744ce88352dbda59d986206e3e5872d98d6
|
|
| MD5 |
8b994d9adee99e01219b496f22c09c3b
|
|
| BLAKE2b-256 |
cafb884f12a1d5e63a593b8417a48fe877dd6b2dd5d7f4db5bd0016aa768425a
|
File details
Details for the file fb_video-0.1.4-py3-none-any.whl.
File metadata
- Download URL: fb_video-0.1.4-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
649c1ba2c8c469fa28d106b26f1e99627b11f2ec38beab3e6e04dafa385295de
|
|
| MD5 |
9219abac76f0d4969b1add0b6dd451f6
|
|
| BLAKE2b-256 |
b41c1145f94da4819db4c08aa4339f0b4ac8480313a036696c0f75882577a4ee
|