Search Youtube videos using python requests without Youtube API
Project description
youtube-search-requests
Search Youtube videos using python requests without Youtube API.
youtube-search-requests can search up to 120+ videos !
Normally youtube-search-requests only extract urls, you can extract additional information by installing youtube-dl, for more information check usage below.
CLI (Command Line Interface) Usage:
usage: python3 -m youtube_search_requests [-h] [-v] [--max-results={Number}] [-t={Number}] [-ei]
[--json]
Search terms
Search Youtube videos using python requests without Youtube API
positional arguments:
Search terms a string terms want to search (if include space, you
must use double quotes "")
optional arguments:
-h, --help show this help message and exit
-v , --validate validate url results, validating urls takes too much
times but it worth to prevent UNPLAYABLE or ERROR
videos
--max-results={Number}
maximum search results
-t={Number} , --timeout={Number}
give number of times to execute search, if times runs
out, search stopped & returning results
-ei , --extract-info
Extract additional info in urls, NOTE: you need to
install youtube-dl module to extract additional info
(pip install youtube-dl)
--json Return results in json format
example usage:
python3 -m youtube_search_requests "fish" --json
# {"urls": ["https://www.youtube.com/watch?v=0gT8Ty0ClHc", ...]}
Simple usage:
from youtube_search_requests import YoutubeSearch
y = YoutubeSearch('fish', max_results=10)
videos = y.search()
print(videos)
also, youtube-search-requests have ability to validate videos
this to prevent UNPLAYABLE or ERROR videos
Search and validating videos usage:
from youtube_search_requests import YoutubeSearch
# by default, validate is set to True
y = YoutubeSearch('delicious fish', max_results=10, validate=True)
videos = y.search()
print(videos)
Extracting additional info videos usage:
from youtube_search_requests import YoutubeSearch
# NOTE: this require youtube-dl module
y = YoutubeSearch('fish', max_results=10, validate=True, extract_info=True)
videos = y.search()
print(videos)
Search with given time usage:
from youtube_search_requests import YoutubeSearch
# given time 60 seconds for searching videos
y = YoutubeSearch('fish', max_results=10, timeout=60)
# if search not complete after 60 seconds
# force it to return results
videos = y.search()
print(videos)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Close
Hashes for youtube-search-requests-0.0.16.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | c096895bba041598e0c333e2f4ac474843459eab2e1abcd5909ce3846433051b |
|
MD5 | 5a1688e2b4898620e35c3cb79e96ab20 |
|
BLAKE2b-256 | 8c57c304bf42b7825b395c7f2e84eace7347bf843a49a17c55375948697096fb |