YouTube Collector
A Python library for collecting YouTube data including channel videos, hashtag videos, keyword search, comments, and channel profiles.
Features
- Collect posts by hashtag
- Collect tagged posts for a user
- Collect posts from brand accounts
- Collect comments from posts
- Support for multiple API providers (RocketAPI and SocialAPI4)
- Rate limiting and error handling
- Pagination support
- Time-based filtering
Installation
pip install youtube-collector
Usage
Collecting Channel Videos
from youtube_collector import YouTubeBrandCollector
collector = YouTubeBrandCollector(api_key="your_api_key")
videos = collector.collect_brand_posts(channel_id="your_channel_id")
print(videos)
Collecting Hashtag Videos
from youtube_collector import YouTubeHashtagCollector
collector = YouTubeHashtagCollector(api_key="your_api_key")
videos = collector.collect_posts_by_hashtag(hashtag_key="your_hashtag")
print(videos)
Collecting Keyword Videos
from youtube_collector import YouTubeKeywordCollector
collector = YouTubeKeywordCollector(api_key="your_api_key")
videos = collector.collect_posts_by_keyword(keyword="your_keyword")
print(videos)
Collecting Comments
from youtube_collector import YouTubeCommentCollector
collector = YouTubeCommentCollector(api_key="your_api_key")
comments = collector.collect_comments(video_id="your_video_id")
print(comments)
Collecting Channel Profile
from youtube_collector import YouTubeProfileCollector
collector = YouTubeProfileCollector(api_key="your_api_key")
profile = collector.collect_profile(channel_id="your_channel_id")
print(profile)
Collecting Recent Videos
from youtube_collector import YouTubeRecentPostCollector
collector = YouTubeRecentPostCollector(api_key="your_api_key")
videos = collector.collect_recent_posts(channel_id="your_channel_id")
print(videos)
Configuration
The library supports various configuration options:
max_hashtag_post_retry: Maximum retries for hashtag posts (default: 3)max_tagged_post_retry: Maximum retries for tagged posts (default: 3)max_brand_post_retry: Maximum retries for brand posts (default: 3)max_comment_retry: Maximum retries for comments (default: 3)
Error Handling
The library includes built-in error handling and retry mechanisms:
- Automatic retry on API failures
- Rate limiting to prevent API throttling
- Time-based filtering to limit data collection
- Exception handling for malformed responses
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Metadata
Release files for youtube-collector 0.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| youtube_collector-0.0.5.tar.gz | 9.7 kB | Without provenance | Details for youtube_collector-0.0.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| youtube_collector-0.0.5-py3-none-any.whl | Python 3 | none | any | Details for youtube_collector-0.0.5-py3-none-any.whl |
Total release size: 26.0 kB
Release files / youtube_collector-0.0.5.tar.gz
| Download URL | youtube_collector-0.0.5.tar.gz |
|---|---|
| Size | 9.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5b55d788d2e959838f355c60986699d388345fa516c459e8c543a40220580912
|
|
BLAKE2b-256 checksum How to use checksums |
d5c516f9255462f908e95357ae010fa7f412322b84a77312d82231ce21d796d2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.6
|
Release files / youtube_collector-0.0.5-py3-none-any.whl
| Download URL | youtube_collector-0.0.5-py3-none-any.whl |
|---|---|
| Size | 16.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a8e39ef664d56e4848828c3293398d62b2dc9568eb7c30daccc59a0db311bb2d
|
|
BLAKE2b-256 checksum How to use checksums |
0e592f8e276e9813239db7c3100745a336317b276f1b08150c3468500e927180
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.6
|
Security for youtube-collector 0.0.5
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.