Giter Site home page Giter Site logo

botspot / youtubuddy Goto Github PK

View Code? Open in Web Editor NEW
34.0 7.0 7.0 413 KB

Search/Watch/Download YouTube videos with a lightweight, interactive tool

License: GNU General Public License v3.0

Shell 100.00%
youtube-dl vlc video youtube selected-videos gui youtube-downloader youtube-player

youtubuddy's Introduction

YouTubuddy

Search/Watch/Download YouTube videos with a lightweight, interactive tool

2020-12-15-220913_1920x1080_scrot

  • Simple
    • Does not need a web browser to operate
    • One bash script that runs everything
    • Based on youtube-dl
    • Minimal dependencies
    • Minimal size: less than 500 KB total
  • Secure
    • YouTube can't track you
    • Videos won't appear in your browsing history
  • Flexible
    • Add your own flags to VLC and youtube-dl. For example, make VLC repeat the playlist, or play in fullscreen
  • Awesome
    • Supports playlists, direct links, and searches
    • Displays video thumbnails and tooltips in search results
    • Allows selecting multiple videos from a list
    • Easily Download multiple videos with a single click
    • Play all selected videos in VLC

To download:

git clone https://github.com/Botspot/youtubuddy

To run:

~/youtubuddy/gui

The first time you run it, YouTubuddy takes care of dependencies and adds a menu button.

Updating:

YouTubuddy will automatically keep itself updated with this main repo. To disable this feature, create a file at ~/youtubuddy/no-update.

How it works:

It turns out youtube-dl has this little-known feature that allows you to search YouTube.
As it searches, youtube-dl creates a JSON file at ~/youtubuddy/data/search.json. Every new line in the file is another search result.
Most of the rest of the script is dedicated to reading that json file and displaying the search results in a YAD dialog window.

Optional Settings:

To change video playback quality:

Open VLC:
Go to tools > preferences
Enable "All" option in settings
In the left pane select "input/codecs" then on the right pane in "track settings" click preferred resolution option and select the video quality.
Note: This option will also degrade the video quality for all video (local, streams etc).

To change video download quality:

To change the default download quality open youtubuddy > options > youtube-dl args, and insert something like -f 135+140.
The 135 sets the video quality, which in this case is 480p. The 140 is audio quality.
List of video quality codes:

code        format  quality
140         m4a       audio only
160         mp4       144p       
133         mp4       240p      
134         mp4       360p      
135         mp4       480p       
136         mp4       720p   
17          3gp       176x144     
36          3gp       320x240     
5           flv       400x240     
43          webm      640x360     
18          mp4       640x360     
22          mp4       1280x720 

youtubuddy's People

Contributors

botspot avatar itai-nelken avatar ryanfortner avatar spectrumgamer75 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

youtubuddy's Issues

youtube-dl check is unstable and will produce false positives

I have youtube-dl version 2022.02.04 (a self compiled version)

What is the goal here?

  if ! command -v youtube-dl >/dev/null || [ ! -z "$(youtube-dl -v 2>&1 | grep '2019\|2020')" ] || [ ! -z "$(youtube-dl -v 2>&1 | grep 'youtube-dl version 2021.01.08')" ] || [ "$(stat --printf="%s" $(command -v youtube-dl))" -ge 2000 ];then

if you just want to make sure youtube-dl is "new enough" then why not do something like this:

function version { echo "$@" | awk -F. '{ printf("%04d%02d%02d\n", $1,$2,$3); }'; }
ytdl_version=$(youtube-dl --version)
if [ $(version "$ytdl_version") -lt $(version "2021.10.07") ]; then
    echo "do stuff to install new version"
fi

also FYI, anything older than something from Feb 2022 is going to be EXTREMLY SLOW to download videos from youtube due to a change on youtube's end that now clients have to solve a puzzle to get fullspeed
you can read about it here: ytdl-org/youtube-dl#30184
commits with the fix are at the bottom

yes I realize this tool does not use youtube-dl to actually download the files (thats handled through the vlc lua script) but you should at least be doing proper checking

VLC won't play any video and stays blank

I have been having this issue from today, whenever I tried to play any video it will try to load in vlc but will eventually stop itself.
Upon checking the vlc logs, I found out about:

-- logger module started --
main: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
main error: no suitable access module for `Imagine Dragons - Believer'
lua error: Couldn't extract youtube video URL, please check for updates to this script
main: playlist is empty
-- logger module stopped --
-- logger module started --
main: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
main error: no suitable access module for `Imagine Dragons - Believer'
lua error: Couldn't extract youtube video URL, please check for updates to this script
main: playlist is empty
-- logger module stopped --
-- logger module started --
main: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
main error: no suitable access module for `Imagine Dragons - Believer'
lua error: Couldn't extract youtube video URL, please check for updates to this script
main: playlist is empty
-- logger module stopped --
-- logger module started --
main: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
main error: no suitable access module for `Imagine Dragons - Believer'
**lua error: Couldn't extract youtube video URL, please check for updates to this script**
main: playlist is empty
-- logger module stopped --

It seems like the main error here is: lua error: Couldn't extract youtube video URL, please check for updates to this script
When I searched about the error, I think this is the possible solution but don't know how to add this in youtubuddy:
https://askubuntu.com/questions/197739/vlc-youtube-videos-wont-play-anymore

@Botspot please have a look if this is a bug or something, as earlier it was playing just fine.

[Feature request] Some Features/Suggestions To Improve The Functionality Of Youtubuddy

Hello,

I like youtubuddy very much and below are some features/suggestions that I think will greatly improve the functionality of it.

1. Thumbnail Size Option [SOLVED]
An option for the thumbnail size will be great, especially for people running the pi with mini TFT touchscreen displays. Will also improve the GUI.

2. Video Playback Quality Option [SOLVED]
This is a must have option for YouTube apps. Adding an option for changing the quality will be of great help for people with older pi models or people with slow internet connection who would like to watch the videos at a lower resolution.

3. Launching VLC Media Player In Full Screen [SOLVED]
Since youtubuddy uses VLC Media Player to play videos, it will be nice to launch it in full screen mode itself. The show controls in full screen mode option is enabled by default on the pi.

4. [REMOVED]

5. Video Won't Be Selected If It Is Not Tick Marked [SOLVED]
This happens that even if you have selected a video to play (the column turns blue) and click the playbutton, it won't play, you have to go and put the tick mark to the video for it to play. I feel this a bit annoying and a fix would be great.

6. Youtubuddy Won't Relaunch Itself, Once VLC Media Player Is Closed [SOLVED]
If vlc media player is closed for (example I don't like the video) then Youtubuddy won't relaunch itself again, you have to go to the menu and launch it manually. It would be nice to see it launching itself automatically just like pi-apps does after running the install or uninstall script for an app. I think it would be better to add this like an option so users can change it according to their needs.

7. Video Download Quality Option [SOLVED]
Just like there should be an option for video playback quality, it would also be great to have a video download quality option.
I think it downloads the videos in the highest quality possible by default because the size for a 10 minute video is like 450 mb,
which is obviously a high resolution video like 720p or 1080p.

These are the changes that I think adding in the stable release will greatly help improve youtubuddy. Keep going @Botspot 😊

add option to use different media player

so far this app is great, but unfortunately the VLC version available from apt crashes my system, so I have the flatpak version that uses this command to start: flatpak run org.videolan.VLC.
that means I can't play videos using this app wich is a shame. it will be great if a settings app (similar to pi-apps or PPT settings) in wich you can select a default media player (or insert the command to start your media player).
here is a example:
youtubebuddy-settings-concept

watchlist only remembers one video

example: I search for one video, I add it to the watchlist. then I find another video that I want to watch later.
now if I open the watchlist I only see the last video I added to it.

Search Box Accepts Complete Blank Inputs

Hello,
I have found out a small bug in youtubuddy, that is that if you type just blank (space bar) without any thing then also it would go for searching videos and would say "something is wrong". I think this is a bit strange and should be fixed?

Thanks.

Anyone having "infinite search" issues?

I've noticed that for some searches, youtubuddy tries to load the results forever, but never succeeds.

Upon closer investigation, I believe I've found a bug in youtube-dl's source code. I've opened an issue on the youtube-dl repository, but it was closed almost immediately because some guy "can't reproduce" it.

Can you guys try running this command and seeing if your youtube-dl has the same issue as mine does?

youtube-dl -sv --print-json ytsearch1:battlebots
# and
youtube-dl -sv --print-json ytsearch1:youtubuddy
# Both of the above commands should produce A TON of output. If they don't, then you've experienced the same bug I found!

If the same bug occurs for you, I encourage you to leave a comment on the youtube-dl issue, saying that the bug affects you too.

check for youtube-dl in other locations + suggestions

I just installed youtube-dl in a fresh Ubuntu 20.04 (x64) install, and youtubuddy had trouble installing pip, so it failed to install youtube-dl.
my suggestion: install youtube-dl from apt if pip fails.
now youtubuddy searched for youtube-dl in /usr/local/bin but youtube-dl from apt was in /usr/bin, so I made a link to it in /usr/local/bin/ and that messed up youtube-dl. so I installed it from snap and changed the line in gui where it checks for youtube-dl to snap/bin/youtube-dl.
my 2nd suggestion: check for youtube-dl in ~/snap/bin/youtube-dl and /usr/bin/youtube-dl as well as where it already checks (/usr/local/bin/youtube-dl).

Videos not playing once opened via VLC

So basically, when using YoutuBuddy today, the videos just straight up wouldn't open, so I decided to launch via Command Line to see if there's any error messages there. There was.

Apparently everything seems to work just fine, until after VLC opens, in which case it states the following

[9eb3b128] lua stream error: Couldn't extract youtube video URL, please check for updates to this script

This leads to VLC opening, but having no video at all, just a blank screen and if you interact with it; it'll ask you to open a video.

Not sure if this is an error brought on by myself, the Lua Script being broken or out of date, or something else entirely. Anyways have a good day.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.