Convert Figma logo to code with AI

trizen logoyoutube-viewer

Lightweight YouTube client for Linux

1,184
86
1,184
41

Top Related Projects

131,248

Command-line program to download videos from YouTube.com and other video sites

82,065

A feature-rich command-line audio/video downloader

8,072

yewtube, forked from mps-youtube , is a Terminal based YouTube player and downloader. No Youtube API key required.

12,083

A lightweight, dependency-free Python library (and command-line utility) for downloading YouTube Videos.

31,014

A libre lightweight streaming front-end for Android.

16,025

Invidious is an alternative front-end to YouTube

Quick Overview

The youtube-viewer project is a command-line tool for watching YouTube videos directly from the terminal. It provides a simple and efficient way to browse and play YouTube content without the need for a web browser.

Pros

  • Cross-platform Compatibility: The tool is designed to work on various operating systems, including Linux, macOS, and Windows.
  • Lightweight and Efficient: The project is lightweight and does not require a heavy dependency on external libraries, making it a fast and efficient solution.
  • Customizable Playback: Users can customize the playback experience, such as adjusting the volume, seeking through the video, and controlling the playback speed.
  • Offline Viewing: The tool supports downloading YouTube videos for offline viewing, allowing users to watch content without an active internet connection.

Cons

  • Limited Video Quality: The tool may not support the highest video quality available on YouTube, as it relies on the capabilities of the underlying media player.
  • Dependency on External Tools: The project requires the installation of external tools, such as a media player, which can add complexity to the setup process.
  • Potential for Abuse: Like any tool that interacts with YouTube, there is a risk of the youtube-viewer being used for purposes that may violate YouTube's terms of service.
  • Lack of Graphical User Interface: The tool is command-line-based, which may not be preferred by users who are more comfortable with graphical user interfaces.

Code Examples

N/A (This is not a code library)

Getting Started

N/A (This is not a code library)

Competitor Comparisons

131,248

Command-line program to download videos from YouTube.com and other video sites

Pros of youtube-dl

  • Supports a wide range of video and audio formats, including MP4, WebM, and more.
  • Actively maintained with frequent updates and bug fixes.
  • Provides a comprehensive set of features and options for downloading and converting media.

Cons of youtube-dl

  • Can be more complex to use, especially for beginners, due to its extensive command-line options.
  • May require additional dependencies or libraries to be installed, depending on the user's system.
  • Focuses primarily on downloading media, while YouTube Viewer provides a more user-friendly interface.

Code Comparison

youtube-dl:

ydl_opts = {
    'outtmpl': '%(title)s.%(ext)s',
    'format': 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best'
}
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
    ydl.download(['https://www.youtube.com/watch?v=dQw4w9WgXcQ'])

YouTube Viewer:

from youtube_viewer.viewer import YouTubeViewer

viewer = YouTubeViewer()
viewer.download('https://www.youtube.com/watch?v=dQw4w9WgXcQ')
82,065

A feature-rich command-line audio/video downloader

Pros of yt-dlp

  • Actively maintained and regularly updated, with a large and engaged community.
  • Supports a wide range of video and audio formats, as well as various streaming platforms.
  • Provides more features and options compared to trizen/youtube-viewer, such as advanced download options and metadata extraction.

Cons of yt-dlp

  • May have a steeper learning curve due to the increased complexity and number of available options.
  • Requires more dependencies and may have a larger footprint compared to the simpler trizen/youtube-viewer.
  • Might not be as user-friendly for casual users who just want a basic YouTube downloader.

Code Comparison

trizen/youtube-viewer:

def main():
    parser = argparse.ArgumentParser(description='YouTube Viewer')
    parser.add_argument('url', help='YouTube video URL')
    parser.add_argument('-q', '--quality', default='bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best',
                        help='Video quality (default: bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best)')
    args = parser.parse_args()

    yt = YouTube(args.url)
    stream = yt.streams.filter(progressive=True).filter(res=args.quality).first()
    stream.download()

yt-dlp/yt-dlp:

def main():
    parser = argparse.ArgumentParser(description='yt-dlp - a youtube-dl fork')
    parser.add_argument('url', nargs='*', help='Video URL(s) to download')
    parser.add_argument('-f', '--format', default='bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best',
                        help='Video format code')
    parser.add_argument('-o', '--output', default='%(title)s.%(ext)s',
                        help='Output file template')
    args = parser.parse_args()

    ydl_opts = {
        'outtmpl': args.output,
        'format': args.format,
    }
    with yt_dlp.YoutubeDL(ydl_opts) as ydl:
        ydl.download(args.url)
8,072

yewtube, forked from mps-youtube , is a Terminal based YouTube player and downloader. No Youtube API key required.

Pros of yewtube

  • yewtube provides a more modern and visually appealing user interface compared to youtube-viewer.
  • yewtube supports a wider range of features, including playlists, subscriptions, and search history.
  • yewtube is actively maintained and has a larger community of contributors.

Cons of yewtube

  • yewtube has a higher learning curve and may be more complex for users who prefer a simpler interface.
  • yewtube may have more dependencies and a larger codebase, which could impact performance on older or less powerful systems.
  • yewtube may not be as customizable as youtube-viewer, which is known for its flexibility.

Code Comparison

youtube-viewer:

def search(self, query):
    """Search for videos on YouTube."""
    url = 'https://www.youtube.com/results?search_query={}'.format(quote_plus(query))
    response = self.session.get(url)
    soup = BeautifulSoup(response.text, 'html.parser')
    results = []
    for video in soup.find_all('div', {'class': 'yt-lockup-content'}):
        title = video.find('a')['title']
        url = 'https://www.youtube.com' + video.find('a')['href']
        duration = video.find('span', {'class': 'video-time'})
        if duration:
            duration = duration.text.strip()
        results.append({'title': title, 'url': url, 'duration': duration})
    return results

yewtube:

async def search(self, query: str) -> List[Video]:
    """Search for videos on YouTube."""
    url = f"https://www.youtube.com/results?search_query={quote_plus(query)}"
    async with self.session.get(url) as response:
        soup = BeautifulSoup(await response.text(), "html.parser")
    results = []
    for video in soup.find_all("div", {"class": "yt-lockup-content"}):
        title = video.find("a")["title"]
        url = "https://www.youtube.com" + video.find("a")["href"]
        duration = video.find("span", {"class": "video-time"})
        if duration:
            duration = duration.text.strip()
        results.append(Video(title=title, url=url, duration=duration))
    return results
12,083

A lightweight, dependency-free Python library (and command-line utility) for downloading YouTube Videos.

Pros of pytube/pytube

  • pytube is a lightweight and fast library for downloading YouTube videos, with a simple and intuitive API.
  • The library is actively maintained and has a large community, ensuring regular updates and bug fixes.
  • pytube provides a wide range of features, including support for various video formats, playlists, and video metadata retrieval.

Cons of pytube/pytube

  • pytube may not be as feature-rich as some other YouTube download libraries, such as trizen/youtube-viewer, which offers more advanced functionality.
  • The library's documentation could be more comprehensive, making it potentially more challenging for new users to get started.

Code Comparison

pytube/pytube:

from pytube import YouTube

yt = YouTube("https://www.youtube.com/watch?v=dQw4w9WgXcQ")
yt.streams.filter(progressive=True, file_extension='mp4').order_by('resolution').desc().first().download()

trizen/youtube-viewer:

from youtube_viewer import YouTubeViewer

yt = YouTubeViewer("https://www.youtube.com/watch?v=dQw4w9WgXcQ")
yt.download()
31,014

A libre lightweight streaming front-end for Android.

Pros of NewPipe

  • NewPipe is a full-featured YouTube client with support for downloading videos, audio, and subtitles.
  • NewPipe has a clean and modern user interface designed for mobile devices.
  • NewPipe is open-source and available on F-Droid, providing a privacy-focused alternative to the official YouTube app.

Cons of NewPipe

  • NewPipe may not have the same level of feature parity as the official YouTube app, particularly for advanced functionality.
  • NewPipe's development is community-driven, which can lead to slower updates and bug fixes compared to a commercial product.
  • NewPipe's reliance on unofficial YouTube APIs may result in compatibility issues or service disruptions over time.

Code Comparison

YouTube-Viewer:

def get_video_info(self, video_id):
    """
    Retrieve video information for the given video ID.
    """
    url = f"https://www.youtube.com/watch?v={video_id}"
    response = self.session.get(url)
    soup = BeautifulSoup(response.text, "html.parser")

    # Extract video title, author, and other metadata
    title = soup.find("span", {"class": "watch-title"}).text.strip()
    author = soup.find("span", {"class": "yt-user-info"}).text.strip()
    # Additional metadata extraction...

NewPipe:

private void loadVideo(final String videoUrl) {
    final String videoId = Parser.getVideoId(videoUrl);
    final StreamInfo streamInfo;
    try {
        streamInfo = ServiceList.getService(serviceId).getStreamInfo(videoId);
        setVideoInfo(streamInfo);
    } catch (Exception e) {
        ErrorActivity.reportError(this, e, null, null,
                ErrorActivity.ErrorInfo.make(UserAction.LOAD_VIDEO, "none", videoUrl, R.string.could_not_load_video));
    }
}
16,025

Invidious is an alternative front-end to YouTube

Pros of Invidious

  • Invidious provides a privacy-focused alternative to the official YouTube website, allowing users to access YouTube content without being tracked by Google.
  • Invidious offers a clean and minimalist user interface, which can be more appealing to some users compared to the cluttered design of the official YouTube website.
  • Invidious supports a wide range of features, including the ability to download videos, adjust playback speed, and customize the appearance of the website.

Cons of Invidious

  • Invidious may not have the same level of feature parity as the official YouTube website, as it is a third-party project.
  • Invidious may not be as widely known or used as the official YouTube website, which could make it less convenient for some users.
  • Invidious may be subject to more frequent downtime or service disruptions compared to the official YouTube website, as it is a smaller and less-resourced project.

Code Comparison

Here's a brief code comparison between Invidious and YouTube Viewer:

Invidious (Ruby):

get '/api/v1/videos/:id' do
  video = Video.find_by(id: params[:id])
  if video
    json video.as_json(only: [:id, :title, :author, :length_seconds, :published, :thumbnail_url, :view_count])
  else
    status 404
    json error: 'Video not found'
  end
end

YouTube Viewer (Perl):

sub get_video_info {
    my ($self, $video_id) = @_;
    my $url = "https://www.youtube.com/get_video_info?video_id=$video_id";
    my $response = $self->ua->get($url);
    if ($response->is_success) {
        my $info = parse_query_string($response->content);
        return $info;
    } else {
        return undef;
    }
}

Both code snippets demonstrate how the respective projects handle the retrieval of video information, but the implementation details differ due to the different programming languages used (Ruby for Invidious, Perl for YouTube Viewer).

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

youtube-viewer

A lightweight application for searching and playing videos from YouTube.

youtube-viewer

  • command-line interface to YouTube.

youtube-viewer

gtk-youtube-viewer

  • GTK+ interface to YouTube.

gtk-youtube-viewer

AVAILABILITY

INSTALLATION

To install youtube-viewer, run:

    perl Build.PL
    sudo ./Build installdeps
    sudo ./Build install

To install gtk-youtube-viewer along with youtube-viewer, run:

    perl Build.PL --gtk
    sudo ./Build installdeps
    sudo ./Build install

TRY

For trying the latest commit of youtube-viewer, without installing it, execute the following commands:

    cd /tmp
    wget https://github.com/trizen/youtube-viewer/archive/master.zip -O youtube-viewer-master.zip
    unzip -n youtube-viewer-master.zip
    cd youtube-viewer-master/bin
    ./youtube-viewer

DEPENDENCIES

For youtube-viewer:

For gtk-youtube-viewer:

Optional dependencies:

PACKAGING

To package this application, run the following commands:

    perl Build.PL --destdir "/my/package/path" --installdirs vendor [--gtk]
    ./Build test
    ./Build install --install_path script=/usr/bin

LOGGING IN

Starting with version 3.7.4, youtube-viewer provides the ~/.config/youtube-viewer/api.json file, which allows setting an YouTube API key and the client ID/SECRET values:

{
    "key":           "API_KEY",
    "client_id":     "CLIENT_ID",
    "client_secret": "CLIENT_SECRET"
}
  • Prerequisite: you must create a Google Platform project. Following the below steps should prompt you to create one if you do not already have one.
  • Enable the YouTube Data v3 API on your project: navigate here and click "Enable" (if you see a blue "Manage" button, it's already enabled).
  • Replace API_KEY with your YouTube API key. Create a new key here by clicking on "Create Credentials" > "API Key".
  • Optionally, in order to log in, replace CLIENT_ID and CLIENT_SECRET with your native client ID and client secret values, by creating a new OAuth 2.0 Client ID here: click "Create Credentials" > "OAuth client ID", then select "TV and Limited Input devices" (tutorial -- may be outdated).

The project must have the following scope enabled: https://www.googleapis.com/auth/youtube

Also, in order to log in, grant access to the project in: https://console.cloud.google.com/apis/credentials/consent

See also: #285, #308.

PIPE-VIEWER

pipe-viewer is a fork of straw-viewer, which parses the YouTube website directly, and thus it does not require an YouTube API key.

REVIEWS

VIDEO REVIEWS

SUPPORT AND DOCUMENTATION

After installing, you can find documentation with the following commands:

man youtube-viewer
perldoc WWW::YoutubeViewer

LICENSE AND COPYRIGHT

Copyright (C) 2012-2024 Trizen

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See https://dev.perl.org/licenses/ for more information.