ViewTube/SaveTube Test
sebaro
2021-10-29/11:03

Another script question
Hugh
2022-05-08/14:56
https://greasyfork.org/en/scripts/435502-suppress-youtube-playlist-links/code

Hi sebaro,

I'm interested in that script but it won't work in my 3.x Greasemonkey for the mobile layout. Is there a way to simplify it with "vanilla" javascript as I see it's requiring use of jquery. To me it seems achievable more simple but in all honesty that's a total guess as I need drastic help. I've tried messing around with but cannot achieve the result as I only took a template and switched some things around hoping for it to function correctly.

What I want to achieve is:

Keep this kind of playlist link untouched.
https://m.youtube.com/playlist?list=PLYPQi44CowsqvRaoQxg32ORQh2aNQDUYl

Remove everything from &list= onward for this.
https://m.youtube.com/watch?v=BE7zmYb0Pec&list=PLYPQi44CowsqvRaoQxg32ORQh2aNQDUYl&index=1

sebaro
2022-05-08/21:48
First line:
document.addEventListener('DOMContentLoaded', modifyLinks, false);

Second line:
https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver#example
Change targetNode to "document.body".
Replace console.log with "modifyLinks()".
Remove "observer.disconnect();".

Error report
Anon
2022-05-09/17:52
Couldn't get the videos content.
https://www.youtube.com/watch?v=pfrgOB_Mp1Y

sebaro
2022-05-11/11:12
Try test version above.

anonymous
2022-05-24/10:44
Couldn't get the videos content.
https://www.youtube.com/watch?v=XVuydzqDAxU

sebaro
2022-05-24/21:57
Try test version above.

Size mismatch
Robert
2022-05-14/18:22
For what it's worth... I found out that when I get this download error
(see above: http://sebaro.pro/contact/#Robert@2022-05-04/19:39)
it's when the default download option is High Definition MP4.

If I change this to Low Resolution MP4, I'm presented with an array (3, 4 or 5) of files to download. Out of these usually one will be the right one. So far, anyway.

sebaro
2022-05-14/21:26
As I said in the reply, sometimes high resolution streams are not available at first for new videos, it takes a while to upload/transcode if the video is large. Somtimes the HD stream is broken, they use the adaptive/dash streams so they don't care for progressive streams.

I don't understand the array part.

Robert J.
2022-05-21/00:35
Sorry, couldn't come back earlier. What I meant is that when High Definition MP4 is available, clicking on the down arrow automatically starts the download (FlashGot + DownThemAll). If it's Low Definition MP4, on the other hand, I have to use Ctl + Mouse click (on a Mac) to get a contextual menu that half of the time shows either FlashGot's pre-defined engine (? in my case DTA Turbo, but it could be curl or something else), or only a contextual menu entry named "FlashGot All". Selecting this opens DownThemAll with an array of anything from 2 to 5 selectable URLs with names made of such long non-descript codes that I find it much easier to select and download them all. At the end only one of the downloaded files is a valid video.

Quite difficult to explain, all this, sorry for not being able to be more clear. If I could upload a screen shot or two it would be easier. But there's no problem per se in the way it's working.

sebaro
2022-05-21/12:31
YouTube sets an attachment header only for HD/720, which means the browser will show a download window just for this, for the rest, because it supports their content-type (video/mp4) it opens them. So in the script I had to show a link to the video so the user can download the video (right-click + save as).

SaveTube has a workaround using Web API to force download but it has to do it in background and it needs enough cache. If your browser version is recent, open script's settings and set "Show Save Link" to off. For small videos this should work fine.

Robert J.
2022-05-22/18:18
OK, I'll try that. Maybe not on my usual browser, slightly antiquated, but on those I use for emergencies. FYI, or rather for the sake of other users, I *think* that your "(right-click + save as)" isd the Windows equivalent of my Mac's "Ctl + click -> save as".

Btw, do you have a repository of the earlier Q&A exchanges, where users could try and search before bothering you?

sebaro
2022-05-22/22:04
The Mac mouse doesn't have the second/right button but the OS supports 2 button mice.

I think the script's web page has all the documentation on how to use it, the only thing that's not there is how a browser works because the user has to know that a browser (this includes user script, addon, extension) has some limitations/restrictions compared to other applications.