Skip to content

A command line interface tool to play youtube video randomly chosen from keywords

Notifications You must be signed in to change notification settings

darshilchauhan/youtube-random

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

A command line interface tool that picks random keyword from keywords.json, searches youtube and plays a random video from first n results.

usage: run.py [-h][-n numofresults] [-p][-k apikey]

optional arguments:
-h, --help show this help message and exit
-n NUMOFRESULTS, --numOfResults NUMOFRESULTS
number of search results
-p, --printOnly Only print result, do not open link
-k APIKEY, --apiKey APIKEY
Youtube api key, store defualt in apikey.json in same directory

Store api key in apikey.json in the following way to make it default:

{
  "key": "<your-api-key>"
}

Make sure Python's webbrowser library is installed. Try running python3 -m webbrowser -t www.google.com to verify. If the error says no runnable browser found, or if chrome is not the default browser, run the following commands:

# Windows
chrome_path='"C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe"'

# MacOS
# chrome_path = 'open -a /Applications/Google\ Chrome.app %s'

# Linux
# chrome_path = '/usr/bin/google-chrome %s'

webbrowser.register('chrome', None,webbrowser.BackgroundBrowser(chrome_path),1)

About

A command line interface tool to play youtube video randomly chosen from keywords

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages