How to use the command 'youtube-viewer' (with examples)
This command-line application, ‘youtube-viewer’, allows users to search for and play videos from YouTube directly from the command line. It provides a convenient way to interact with YouTube without the need for a web browser or GUI.
Use case 1: Search for a video
Code:
youtube-viewer search_term
Motivation: The search_term argument allows users to search for a specific video by providing a keyword or phrase. Searching for a video directly from the command line can be faster and more efficient than using a web browser.
Explanation: The search_term
argument represents the keyword or phrase to search for on YouTube. It can be any word or combination of words that you want to search for.
Example output: If you want to search for funny cat videos, you would run the following command: youtube-viewer "funny cat videos"
. The command will display a list of search results related to the search term.
Use case 2: Log in to your YouTube account
Code:
youtube-viewer --login
Motivation: Logging in to your YouTube account allows you to access personalized content, such as your saved playlists and recommended videos.
Explanation: The --login
option prompts you to enter your YouTube credentials, including your username and password, to log in to your account. This is useful if you want to access your personalized content or perform actions that require authentication, such as liking a video.
Example output: Running the command youtube-viewer --login
will prompt you to enter your username and password. Once you have successfully logged in, you can access your personalized content.
Use case 3: Watch a video in VLC with a specific URL
Code:
youtube-viewer --player=vlc https://youtube.com/watch?v=dQw4w9WgXcQ
Motivation: Watching videos in a dedicated media player like VLC can provide a better viewing experience with more features and customization options.
Explanation: The --player=vlc
option specifies that you want to open the video in VLC instead of the default video player. The URL argument represents the specific video URL on YouTube that you want to watch.
Example output: By running the command youtube-viewer --player=vlc https://youtube.com/watch?v=dQw4w9WgXcQ
, the video with the specified URL will open in VLC, providing a better viewing experience with more advanced playback controls and settings.
Use case 4: Display a search prompt and play the selected video in 720p
Code:
youtube-viewer -7
Motivation: By displaying a search prompt and playing the selected video in 720p, you can quickly find and watch high-definition videos directly from the command line.
Explanation: The -7
option prompts you to enter a search term and displays a list of search results. You can then select a video by its corresponding number and play it in 720p resolution.
Example output: Running the command youtube-viewer -7
will display a search prompt. After entering a search term, a list of search results will be shown. You can select a video by its number and play it in 720p resolution, providing a high-definition viewing experience from the command line.
Conclusion:
The ‘youtube-viewer’ command-line application provides a convenient way to search for and play videos from YouTube directly from the command line. It allows users to log in to their YouTube accounts, watch videos in different media players, and display search prompts for quick video playback. With its wide range of features, ‘youtube-viewer’ offers a seamless YouTube viewing experience from the command line.