Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The Ultimate Way of Browsing Channels #1320

Open
wants to merge 17 commits into
base: master
Choose a base branch
from

Commits on May 2, 2023

  1. The Ultimate Way of Browsing Channels

    The script works extremely fast except the first time to update the whole data. It takes about 2 minutes to update the whole database with 80 different channels. You can set a cronjob for this. It's not a heavy work for the PC. It justs fetch the text data with yt-dlp. Video example below:
    
    This script is a sophisticated and ingenious tool designed to streamline your YouTube experience by organizing and managing your favorite YouTube channels, allowing you to browse and watch videos directly within the script without ever visiting its website. You can assign the channels inside various categories such as "Tech", "Science", "Sports", etc. The videos can be played using the 'mpv' media player. Moreover, the script allows you to sort videos based on view count or duration; download videos; and even maintain a "Watch Later" list. If you combine this script with "SponsorBlock" lua script created for "mpv", then you will have the ultimate experience. SponsorBlock removes all sponsored segments in a video including intros, outros or similar unnecessary parts. It's normally a browser extension but is also available for "mpv".
    
    No browsers, accounts, distractions, crappy algorithm and recommendations, advertisements, sponsors, intros, outros, fillers or empty spaces. We eliminate them all.
    
    Required Programs: dmenu | mpv | jq | yt-dlp
    
    FEATURES
    1. Browse all videos from all channels you set at the same time. You can filter titles through dmenu.
    2. Browse a channel's videos.
    3. Select a channel either from the main menu or inside a Category.
    4. Watch, Download or Put videos in a "Watch Later List".
    5. Sort videos by view or duration. The default sort is upload date. The only problem is, we can't have the exact upload date, so we can't apply much more advanced filtering. It can be done but it makes fetching the data for the first time too slow.
    6. The menus have a complex loop system. It always continues where you left off. The script doesn't close itself when you make a selection. So you don't have to run the script over and over again and get to where you left off. You can also press Escape to return to a prior menu.
    7. You won't see the URLs or any unnecessary things inside dmenu. Just the titles.
    
    
    
    JUSTIFICATION
    This script is incredibly beneficial for those who seek a minimalist and focused approach to consuming content on YouTube. By providing a CLI-based interface (dmenu), the script reduces distractions and clutter that are commonly encountered on the Youtube website. It allows users to personalize their content consumption and manage channels more effectively. The script is also remarkably efficient and easy to navigate, providing a user-friendly experience that saves time and promotes productivity.
    
    The script is organized into functions that each perform a specific task, such as updating channel data, retrieving video titles, playing videos, downloading videos, adding videos to the watch later list, and browsing all channels. These functions are called by the main script to provide the user with various options for navigating and interacting with the videos.
    
    The script makes use of various Bash features such as associative arrays, shell redirection and piping, to simplify and streamline the code. It also uses conditionals and loops to handle different user input and error cases. Overall, this script is a powerful and flexible tool for browsing, watching, organizing YouTube channels, and it provides a great example of Bash usage to automate and streamline complex tasks.
    
    DETAILED EXPLANATION
    - The script begins by defining two associative arrays, CHANNELS and CATEGORIES, which store the YouTube channel names along with their respective URLs and categories. It then sets the directories for storing data and videos, and creates them if they do not already exist.
    - The 'update_data' function updates the metadata for a given channel, while the 'update_all_channels' function updates metadata for all channels. The metadata includes the video title, URL, view count, and duration, which are extracted using 'yt-dlp' and 'jq' utilities.
    - The 'get_videos' function retrieves the video titles from the metadata of a given channel, sorted by the specified criteria (if any). The 'video_url' function returns the URL of a video based on its title and channel name. The 'play_video' and 'download_video' functions use 'mpv' and 'yt-dlp', respectively, to play or download a video given its title and channel name.
    - The 'add_to_watch_later' function appends the video title and channel name to a watch later list, while the 'play_watch_later' and 'delete_from_watch_later' functions play a video from the list or remove it, respectively.
    - The 'get_all_videos' function retrieves all video titles from the metadata of all channels, sorted by the specified criteria. The 'browse_all_channels' function lets you browse through all channels and select a video to watch, download, or add to the watch later list.
    - The main part of the script first prompts the user to update the database of channels. If the user chooses to do so, the 'update_all_channels' function is called. The script then presents the user with options to browse all channels, browse channels by category, or browse the watch later list. The script loops through these options until the user decides to exit.
    emrakyz authored May 2, 2023
    Configuration menu
    Copy the full SHA
    8e7c55f View commit details
    Browse the repository at this point in the history

Commits on May 30, 2023

  1. Configuration menu
    Copy the full SHA
    395a277 View commit details
    Browse the repository at this point in the history

Commits on Sep 29, 2023

  1. Configuration menu
    Copy the full SHA
    9e2bf97 View commit details
    Browse the repository at this point in the history
  2. Update Channels & Notify

    emrakyz authored Sep 29, 2023
    Configuration menu
    Copy the full SHA
    4fc941b View commit details
    Browse the repository at this point in the history

Commits on Oct 17, 2023

  1. improve further

    emrakyz authored Oct 17, 2023
    Configuration menu
    Copy the full SHA
    96b997e View commit details
    Browse the repository at this point in the history

Commits on Nov 18, 2023

  1. Configuration menu
    Copy the full SHA
    2734857 View commit details
    Browse the repository at this point in the history
  2. Add extra error handling

    emrakyz authored Nov 18, 2023
    Configuration menu
    Copy the full SHA
    e15f5ee View commit details
    Browse the repository at this point in the history
  3. Add robust error handling.

    emrakyz authored Nov 18, 2023
    Configuration menu
    Copy the full SHA
    3ba7e6d View commit details
    Browse the repository at this point in the history

Commits on Nov 19, 2023

  1. Configuration menu
    Copy the full SHA
    996af99 View commit details
    Browse the repository at this point in the history
  2. extra error handling

    emrakyz authored Nov 19, 2023
    Configuration menu
    Copy the full SHA
    60866ca View commit details
    Browse the repository at this point in the history
  3. add some comments

    emrakyz authored Nov 19, 2023
    Configuration menu
    Copy the full SHA
    a7061f7 View commit details
    Browse the repository at this point in the history

Commits on Dec 2, 2023

  1. Improve further.

    emrakyz authored Dec 2, 2023
    Configuration menu
    Copy the full SHA
    ce57705 View commit details
    Browse the repository at this point in the history
  2. Minor improvements

    emrakyz authored Dec 2, 2023
    Configuration menu
    Copy the full SHA
    aa74c7a View commit details
    Browse the repository at this point in the history

Commits on Dec 4, 2023

  1. Small fix

    emrakyz authored Dec 4, 2023
    Configuration menu
    Copy the full SHA
    d5f31b5 View commit details
    Browse the repository at this point in the history

Commits on Jul 1, 2024

  1. Update channelrefresh

    emrakyz authored Jul 1, 2024
    Configuration menu
    Copy the full SHA
    a43657a View commit details
    Browse the repository at this point in the history
  2. Update ybrowser

    emrakyz authored Jul 1, 2024
    Configuration menu
    Copy the full SHA
    37ffc69 View commit details
    Browse the repository at this point in the history
  3. Update ybrowser

    emrakyz authored Jul 1, 2024
    Configuration menu
    Copy the full SHA
    ae85e22 View commit details
    Browse the repository at this point in the history