View YouTube without ads

Moderator: Forum moderators

User avatar
mikewalsh
Moderator
Posts: 5564
Joined: Tue Dec 03, 2019 1:40 pm
Location: King's Lynn, UK
Has thanked: 566 times
Been thanked: 1678 times

Re: View Youtube without ads

Post by mikewalsh »

JASpup wrote: Wed Dec 02, 2020 11:54 am

I'm in a puplet with Light instead of Pale Moon. It's not easy to switch default browsers. I chose a portable Firefox and it defaulted to Chrome instead. I went to Firefox because I couldn't choose Chrome.

@JASpup :-

One thing you learn in Puppy, very early on, is NOT to try setting the default browser FROM the browser's own settings page. This never, EVER works in Puppy.....something to do with Puppy's implementation of the xdg protocols, I believe. Instead, you use the 'Default Applications Chooser', under Menu->Setup.

And don't worry if the browser you want doesn't appear in the appropriate drop-down box. Just manually edit the entry, and set the $PATH yourself to the browser's launcher. The other way this can be done - same thing, different method - is to go into /usr/local/bin, open the 'defaultbrowser' entry with Geany, then change the $PATH there, instead.

You almost always need to do this with any of the portables, unless you've linked the launcher into one of your 'bins' and re-named it to one of the 'standard' names.

Mike. ;)

Puppy "stuff" ~ MORE Puppy "stuff" ~ ....and MORE! :D
_______________________________________________________

Image

User avatar
MochiMoppel
Posts: 1109
Joined: Mon Jun 15, 2020 6:25 am
Location: Japan
Has thanked: 17 times
Been thanked: 356 times

View Youtube without ads

Post by MochiMoppel »

greengeek wrote: Thu Dec 03, 2020 8:09 am

I'm testing on Tahr32 at the moment and get a message saying "xclip or xsel not installed".

Which of these would you recommend best?

cheers!

EDIT : Ahhh, ok i see it needs both.

No, it needs only one of them. I checked Tahr6.0.6 and found xclip documentation but no trace of the binary, According to /root/.packages/builtin_files/xclip the binary is not in the list of installed files. Very strange. So I assume that it worked for you after installing xsel, right?

User avatar
JASpup
Posts: 1653
Joined: Sun Oct 04, 2020 10:52 am
Location: U.S.A.
Has thanked: 70 times
Been thanked: 89 times

Re: View Youtube without ads

Post by JASpup »

mikewalsh wrote: Thu Dec 03, 2020 10:45 am

set the $PATH yourself to the browser's launcher. The other way this can be done - same thing, different method - is to go into /usr/local/bin, open the 'defaultbrowser' entry with Geany, then change the $PATH there, instead.

Not sure the specifics there, but it looks like it could be useful, thanks.

The default chooser was finicky but seemed redeemable (hopeful).

The late 32bit Chrome (in my last screenshot), won't even let you make it default in its settings. There might be an option first run but I never choose it.

On the Whiz-Neophyte Bridge
Linux Über Alles
Disclaimer: You may not be reading my words as posted.

User avatar
greengeek
Posts: 1200
Joined: Thu Jul 16, 2020 11:06 pm
Has thanked: 339 times
Been thanked: 145 times

Re: View Youtube without ads

Post by greengeek »

MochiMoppel wrote: Thu Dec 03, 2020 11:51 am

No, it needs only one of them. I checked Tahr6.0.6 and found xclip documentation but no trace of the binary, According to /root/.packages/builtin_files/xclip the binary is not in the list of installed files. Very strange. So I assume that it worked for you after installing xsel, right?

Yes, xsel from PPM did the trick perfectly thank you.

Strange thing though - when I first saw the dependencies error message I tried to run xclip and xsel from cli to confirm functionality but found neither available in my system yet when I tried to install xclip the ppm indicated xclip is already installed.
Some minor weirdness within my Tahr.

Very handy way to play videos thanks.

User avatar
MochiMoppel
Posts: 1109
Joined: Mon Jun 15, 2020 6:25 am
Location: Japan
Has thanked: 17 times
Been thanked: 356 times

View Youtube without ads

Post by MochiMoppel »

greengeek wrote: Thu Dec 03, 2020 5:43 pm

Strange thing though - when I first saw the dependencies error message I tried to run xclip and xsel from cli to confirm functionality but found neither available in my system yet when I tried to install xclip the ppm indicated xclip is already installed.
Some minor weirdness within my Tahr.

xclip is installed in Tahr6.0.5. It got lost in Tahr6.0.6. Newer is not always better.
Hang on to your trusted Slacko5.6 ;)

User avatar
fredx181
Posts: 2558
Joined: Tue Dec 03, 2019 1:49 pm
Location: holland
Has thanked: 273 times
Been thanked: 992 times
Contact:

Re: View Youtube without ads

Post by fredx181 »

Here's a little variation of MochiMoppel's script, attached script "yt-dnd", depends on having yad installed.
I thought it'd be nice to have a little box to drag n' drop any youtube link onto, running the attached script, there will appear an icon in upper left corner, example usage:

Drag n' drop youtube links
Drag n' drop youtube links
yt-dnd.gif (452.07 KiB) Viewed 2308 times

Fred

Attachments
yt-dnd.gz
Remove fake .gz and make executable
(8.09 KiB) Downloaded 122 times
User avatar
MochiMoppel
Posts: 1109
Joined: Mon Jun 15, 2020 6:25 am
Location: Japan
Has thanked: 17 times
Been thanked: 356 times

Youtube without ads

Post by MochiMoppel »

@fredx181 Thanks. Works with my old yad version. Could be handy when keyboard is not accessible or when using a tablet (no idea if this would be feasible). Drag n' drop can be a bit tricky when dragging linked preview images as YT preview images are bigger than the drop icon, making it hard to get visual feedback.

User avatar
josejp2424
Posts: 167
Joined: Sun Jul 12, 2020 11:40 pm
Has thanked: 196 times
Been thanked: 103 times

Re: View Youtube without ads

Post by josejp2424 »

MochiMoppel thank you very much, for this simple script that works very well.

User avatar
amethyst
Posts: 2355
Joined: Tue Dec 22, 2020 6:35 am
Has thanked: 55 times
Been thanked: 473 times

Re: View Youtube without ads

Post by amethyst »

Just a mention. I installed the Adblock Latitude add-on in Palemoon. Blocks youtube ads nicely. Too many videos not playing with the embedded method. Another trick to block ads in youtube is to add a rest sign [.] after com in the video url (so you have .com. in the url). Unfortunately the last mentioned method does not always work. And another suggestion. When searching for youtube videos use microsoft bing/DuckDuckGo/Yahoo search engines instead. Click on the videos tab and search for your video, eg: youtube tina turner concerts. Results will display. Now the nice - clicking a link will play the video in the same window (without the ads even if you don't have an ad blocker), it does not go to the youtube page with all its crap loadings.

User avatar
foxpup
Posts: 186
Joined: Fri Jul 24, 2020 1:23 pm
Location: Europe near the Northsea
Has thanked: 75 times
Been thanked: 32 times

Re: View Youtube without ads in defaultmediaplayer

Post by foxpup »

I got the idea to put defaultmediaplayer in for the BROWSER.

In Fossapup the defaultmediaplayer is mpv.
mpv needs youtube-dl to play url's and that was not in my Fossapup, so downloaded that and put it in /usr/bin.
And then this nice script works with mpv as well :thumbup:

williams2
Posts: 1023
Joined: Sat Jul 25, 2020 5:45 pm
Been thanked: 288 times

Re: View Youtube without ads

Post by williams2 »

I disable the mpv youtube-dl hook by putting

ytdl=no

in the file /root/.config/mpv/mpv.conf
so that mpv will play a streaming file directly and will not try to download it first using youtube-dl, so youtube-dl does not need to be installed.

Or you can use the mpv command line option --ytdl=no

This might break something that expects the mpv youtube hook to be enabled by default.

User avatar
fredx181
Posts: 2558
Joined: Tue Dec 03, 2019 1:49 pm
Location: holland
Has thanked: 273 times
Been thanked: 992 times
Contact:

Re: View Youtube without ads

Post by fredx181 »

williams2 wrote: Sat Feb 20, 2021 8:00 pm

I disable the mpv youtube-dl hook by putting

ytdl=no

in the file /root/.config/mpv/mpv.conf
so that mpv will play a streaming file directly and will not try to download it first using youtube-dl, so youtube-dl does not need to be installed.

Or you can use the mpv command line option --ytdl=no

This might break something that expects the mpv youtube hook to be enabled by default.

For me there are many videos that won't play this way.
Running mpv with youtube-dl enabled, I can play almost all.

User avatar
foxpup
Posts: 186
Joined: Fri Jul 24, 2020 1:23 pm
Location: Europe near the Northsea
Has thanked: 75 times
Been thanked: 32 times

Re: View Youtube without ads

Post by foxpup »

fredx181 wrote: Mon Feb 22, 2021 9:21 am

For me there are many videos that won't play this way.
Running mpv with youtube-dl enabled, I can play almost all.

I second your findings @fredx181
@williams2 It does not work for me with ytdl=no

williams2
Posts: 1023
Joined: Sat Jul 25, 2020 5:45 pm
Been thanked: 288 times

Re: View Youtube without ads

Post by williams2 »

ytdl=no is just convenient when mpv can play directly, by itself, an online stream, and does not need youtube-dl.
By default, mpv will try to download the URL first using youtube-dl and then it will try to play the URL directly.

For example,
mpv http://simplexstream.com:8058/
mpv --no-ytdl http://simplexstream.com:8058/

If mpv can not play a URL directly, but youtube-dl can, then the youtube-dl hook should work (if it is enabled.)

Personally, I tend to download a media file first, using wget or youtube-dl, then play it with mpv.
And you can usually watch/listen to the the file while it is still downloading.

Zuzia
Posts: 106
Joined: Wed Oct 21, 2020 2:32 pm
Has thanked: 13 times
Been thanked: 6 times

Re: View Youtube without ads

Post by Zuzia »

Just install firefox + ublock plugin :) No adds at all.

User avatar
Grey
Posts: 1984
Joined: Wed Jul 22, 2020 12:33 am
Location: Russia
Has thanked: 75 times
Been thanked: 355 times

Re: View Youtube without ads

Post by Grey »

When using mpv, you can shorten the script to this:

Code: Select all

#!/bin/sh
PLAYER=defaultmediaplayer
YTURL=$(xclip -o -sel clip) || YTURL=$(xsel -b)
(($?)) && exec Xdialog -msg "xclip or xsel not installed" x
exec $PLAYER "$YTURL"

In this case, links work not only from youtube, but also from other well-known sites, for example xvideos, spankbang, etc. Don't laugh, it was just necessary to check somewhere :)

Fossapup OS, Ryzen 5 3600 CPU, 64 GB RAM, GeForce GTX 1050 Ti 4 GB, Sound Blaster Audigy Rx with amplifier + Yamaha speakers for loud sound, USB Sound Blaster X-Fi Surround 5.1 Pro V3 + headphones for quiet sound.

User avatar
foxpup
Posts: 186
Joined: Fri Jul 24, 2020 1:23 pm
Location: Europe near the Northsea
Has thanked: 75 times
Been thanked: 32 times

Re: View Youtube without ads

Post by foxpup »

:thumbup2:
Thanks Grey! Works well on lbry.tv or odysee.com as well.
(Not laughing, just smiling ;-) )

User avatar
amethyst
Posts: 2355
Joined: Tue Dec 22, 2020 6:35 am
Has thanked: 55 times
Been thanked: 473 times

Re: View Youtube without ads

Post by amethyst »

You can easily play all your youtube videos (unless youtube restricts to only playing the video on the youtube site only, which happens sometimes) directly from a search engine site like DuckDuckGo without ads and without going to the youtube site. In cases where youtube forces you to stream from their site only, install an adblock plugin. To actually download a file, a site like 9xbuddy.com works great.

User avatar
Grey
Posts: 1984
Joined: Wed Jul 22, 2020 12:33 am
Location: Russia
Has thanked: 75 times
Been thanked: 355 times

Re: View Youtube without ads

Post by Grey »

amethyst wrote: Fri Mar 19, 2021 6:01 pm

You can easily play all your youtube videos

Yes we can :thumbup: . But specifically mpv is needed for what the arrow points to:

mpv_hwdec.jpg
mpv_hwdec.jpg (157.73 KiB) Viewed 2070 times

Fossapup OS, Ryzen 5 3600 CPU, 64 GB RAM, GeForce GTX 1050 Ti 4 GB, Sound Blaster Audigy Rx with amplifier + Yamaha speakers for loud sound, USB Sound Blaster X-Fi Surround 5.1 Pro V3 + headphones for quiet sound.

User avatar
MochiMoppel
Posts: 1109
Joined: Mon Jun 15, 2020 6:25 am
Location: Japan
Has thanked: 17 times
Been thanked: 356 times

Re: View Youtube without ads

Post by MochiMoppel »

amethyst wrote:

You can easily play all your youtube videos (unless youtube restricts to only playing the video on the youtube site only, which happens sometimes) directly from a search engine site like DuckDuckGo without ads and without going to the youtube site.

If it were that easy I would do it, but IIRC DuckDuckGo does technically what my script does, only less flexible.
I can't test it again because I don't know how to enforce this mode. I remember that DuckDuckGo proposes to play YT videos in DDG for security/privacy reasons, but once I declined this offer and chose to go directly to YT I was never able to play in DDG again. There must be a setting for this option somewhere. Where is it?

User avatar
amethyst
Posts: 2355
Joined: Tue Dec 22, 2020 6:35 am
Has thanked: 55 times
Been thanked: 473 times

Re: View Youtube without ads

Post by amethyst »

MochiMoppel wrote: Sat Mar 20, 2021 6:01 am
amethyst wrote:

You can easily play all your youtube videos (unless youtube restricts to only playing the video on the youtube site only, which happens sometimes) directly from a search engine site like DuckDuckGo without ads and without going to the youtube site.

If it were that easy I would do it, but IIRC DuckDuckGo does technically what my script does, only less flexible.
I can't test it again because I don't know how to enforce this mode. I remember that DuckDuckGo proposes to play YT videos in DDG for security/privacy reasons, but once I declined this offer and chose to go directly to YT I was never able to play in DDG again. There must be a setting for this option somewhere. Where is it?

If you are talking about your initial embedded script, no that's very limited and quite frankly inadequate as I could not play most of my files. About that setting - not sure, Idon't think I have had that problem before using Palemoon. I've always been able to switch back. Don't know if it's a setting stored in your browser config. Have you tried to clear cookies? Also - when you select the video to play, you can select the video url for playing on the youtube site directly.

User avatar
Grey
Posts: 1984
Joined: Wed Jul 22, 2020 12:33 am
Location: Russia
Has thanked: 75 times
Been thanked: 355 times

Re: View Youtube without ads

Post by Grey »

Come on, why grumble. MochiMoppel made a good script, it is clearly useful to many. Since he did it, then it was necessary.

Fossapup OS, Ryzen 5 3600 CPU, 64 GB RAM, GeForce GTX 1050 Ti 4 GB, Sound Blaster Audigy Rx with amplifier + Yamaha speakers for loud sound, USB Sound Blaster X-Fi Surround 5.1 Pro V3 + headphones for quiet sound.

User avatar
amethyst
Posts: 2355
Joined: Tue Dec 22, 2020 6:35 am
Has thanked: 55 times
Been thanked: 473 times

Re: View Youtube without ads

Post by amethyst »

Grey wrote: Sat Mar 20, 2021 7:32 am

Come on, why grumble. MochiMoppel made a good script, it is clearly useful to many. Since he did it, then it was necessary.

There's nothing wrong with the script but the embedding feature has serious limitations and inadequate for my personal use. If it plays all (well at least most of) the videos you want to play, then good for you.

User avatar
MochiMoppel
Posts: 1109
Joined: Mon Jun 15, 2020 6:25 am
Location: Japan
Has thanked: 17 times
Been thanked: 356 times

Re: View Youtube without ads

Post by MochiMoppel »

Never mind, I figured it out and now find the "Always play on DuckDuckGo" option even less appealing than before.

1) Does not work from a YouTube page showing search result thumbnails
2) Works only on Palemoon's "Videos" tab. This tab shows a lot of Microsoft News and Dailymotion videos, not necessarily YT.
3) Display mode can be changed from this tab. There is a link to https://duckduckgo.com/settings Despite setting the option to "Prompt me" this option often fails and I end up with the last used mode, no prompt.
4) The video size is too small for me. I do not need and want fullscreen, I just want the video to fill the window
5) Even when playing in DuckDuckGo, the thumbnails at the end of each YT video will not play in DDG, no matter what mode is selected.

My script helps me to avoid all these shortcomings. I understand that other users have other needs and I don't claim to provide a solution that can please everybody.

YoutubeWarning.png
YoutubeWarning.png (78.67 KiB) Viewed 1474 times
User avatar
amethyst
Posts: 2355
Joined: Tue Dec 22, 2020 6:35 am
Has thanked: 55 times
Been thanked: 473 times

Re: View Youtube without ads

Post by amethyst »

"This can be changed in settings"

User avatar
amethyst
Posts: 2355
Joined: Tue Dec 22, 2020 6:35 am
Has thanked: 55 times
Been thanked: 473 times

Re: View Youtube without ads

Post by amethyst »

The embedded script plays the minimum videos for me (useless actually). I can watch many more videos with this method. Each to his own I suppose. You just need to search correctly to see only youtube results. Default viewing window is bigger using Bing. ACTUALLY : Full screen works for me with DuckDuckGo, Bing, Yahoo.

User avatar
peppyy
Posts: 328
Joined: Fri Jan 22, 2021 2:11 pm
Location: VT USA
Has thanked: 66 times
Been thanked: 28 times

Re: View Youtube without ads

Post by peppyy »

I copy the link and use VLC. Media tab - Open location from clipboard. Flawless playback for me.

Puppy Linux. It just works!
Foassapup 9.5 64-(Frugal) Mobo, M5A99FX PRO - CPU, AMD FX-6300 6 core - mem,32GB - Storage
ssd 128GB M4 - ssd-256GB APS - ssd-1TB PNY - GPU GeForce GTX 1060 GAMING X 6G. Yes it's a Mutt.

User avatar
MochiMoppel
Posts: 1109
Joined: Mon Jun 15, 2020 6:25 am
Location: Japan
Has thanked: 17 times
Been thanked: 356 times

Re: View Youtube without ads

Post by MochiMoppel »

amethyst wrote:

"This can be changed in settings"

My problem was that this dialog never appeared again after choosing "Watch on Youtube". "Remember my choice" means no more dialog = no more hint where to change the setting. I found the change option on the "Videos" tab, which I normally never use, and I explained this in point 3) of my post...

User avatar
amethyst
Posts: 2355
Joined: Tue Dec 22, 2020 6:35 am
Has thanked: 55 times
Been thanked: 473 times

Re: View Youtube without ads

Post by amethyst »

I normally use DuckDockGo not sure if that warning appears when using Bing, Yahoo. Maybe worth checking it out. As mentioned previously one can click the youtube site link to play on youtube site. Warning thus basically irrelevant to me once it's set.

Last edited by amethyst on Sat Mar 20, 2021 12:54 pm, edited 1 time in total.
User avatar
amethyst
Posts: 2355
Joined: Tue Dec 22, 2020 6:35 am
Has thanked: 55 times
Been thanked: 473 times

Re: View Youtube without ads

Post by amethyst »

peppyy wrote: Sat Mar 20, 2021 12:31 pm

I copy the link and use VLC. Media tab - Open location from clipboard. Flawless playback for me.

Interesting, I have great difficulty playing it with VLC. What version are you using? in past versions one had to update the youtube.lua file regularly otherwise zilts was happening

Post Reply

Return to “Tips & Tweaks”