Extensions :  K-Meleon Web Browser Forum
All about K-Meleon extensions. 
Pages: Previous12345Next
Current Page: 3 of 5
Re: Download YouTube Videos as MP4
Posted by: siria
Date: February 12, 2020 05:42PM

Just mentioned the title in the URL since the original script and yours too append it to the link href. But when I tested a download without it, it worked anyway, so turned out unnecessary. Probably was needed in the past.

Quote
JohnHell
The script is not intended for the mobile version. But I see it doesn't change much. Except that maybe your wish is too far. I only see the .3gp version for download (itag 17).

Ah right, the mobile youtube page offers videos in 360.mp4 and 240.3gp!
That's great, was badly missing the "tiny" 3gp version in the Classic View after G. killed it smiling smiley
After they had already killed the much better quality 360-flv versions, same quality as mp4 but much smaller filesize too sad smiley

In some weeks the crucial advantage of the mobile layout will be the html filesize too.
The "modern" view eats here a whopping 3MB already, and that's even without seeing anything at all, without loading any additional external css/js-files, let alone run them. Just the plain html-source is so giant already, with tons of scripts embedded directly. Too heavy on my system, and completely useless anyway.

Options: ReplyQuote
Re: Download YouTube Videos as MP4
Posted by: JohnHell
Date: February 27, 2020 01:07AM

They switched my profile "without my consent" (unlogged is still possible to see the old layout for me)

Ok, it would have been without my consent anyway, but you know what I mean. Isn't even March yet

I made a fix for myself, but "oooh myyyy" this would need a totally revamp with all the dependencies it has on the old layout... and as nothing exists, and even if it loads, I doubt the old elements denominations would be there...

I'm thinking of keeping the formats selection (even if no one uses them by editing the script itself) and.... nothing else, just extract the URLs and create a new kind of menu to say something. Oh, and extract the title... THE TITLE!!!! Come'on, they even construct the page title with javascript!!!!! No way to track the page you visit in the browser History this way

I'm not going to do anything today or tomorrow (not the best days) but this will make me change almost everything. As I'm saying, I'm not going in a hurry, so if you need it, isn't needed to say, but use download pages.

Oh, and don't forget it, 2MB of page every time you go to a YouTube watch page. 2MB!!! (without external sources)



Edited 3 time(s). Last edit at 02/27/2020 01:31AM by JohnHell.

Options: ReplyQuote
Re: Download YouTube Videos as MP4
Posted by: siria
Date: February 27, 2020 02:10AM

Quote
JohnHell
and.... nothing else, just extract the URLs and create a new kind of menu to say something. Oh, and extract the title... THE TITLE!!!! Come'on, they even construct the page title with javascript!!!!! No way to track the page you visit in the browser History this way

Yeah, they destroy everything sad smiley Am dreading too all the work this will require for even an extremely basic access workaround sad smiley And the worst is, at the moment we can even be 'glad' to get the source at all, but am dreading the day when the Google boss finishes his destruction and doesn't only block all display, but even blocks any access at all. Which can happen any day soon sad smiley

Not even the titles? That makes no sense at all, incredible how low they've sunk sad smiley
But for us with tweaks as life saver, could it be that adding a little url hash fills the history again? At any rate adding a hash fires $OnLoad, have just tested, a new entry does show up in my iniwrite-history list. That would mean first unhide the title by macro, then "document.location.hash=top" or whatever...

3MB is beyong words too. But at least the mobile page seems to have only 170kB, so at the moment still hope to survive a bit longer ;-)

Options: ReplyQuote
Re: Download YouTube Videos as MP4
Posted by: siria
Date: February 29, 2020 08:38AM

First draft success! Finally got that mysterious JSON-stuff working to read the video URL and properties, and shows it as info alert.
The only prob is this method only works in KM74 or newer, but KM1.6 seems too old for multiple nested jsons in jsons and even with arrays in between. Will have to crop out a smaller chunc somehow.

=============================
try{
var x=document.getElementById('player-mole-container');
if (!x) var x=document.getElementById('player-wrap');
x=x.innerHTML.toString();
var y=x.split('ytplayer.config = ')[1];
var z=y.split(';ytplayer.load =')[0];
var JON1=JSON.parse(z);
var JON2=JSON.parse(JON1.args.player_response);
// SIZE: formats are in array, needs loop to check which one is which size?
// Currently in classic view I get for [0] itag18 360p and for [1] itag22 720p
var VID=JON2.streamingData.formats[0];
var INFO=VID.quality+' '+VID.qualityLabel+' / '+VID.width+' x '+VID.height+' px';
INFO+='\nDuration in sec: '+VID.approxDurationMs.slice(-3);
if (VID.contentLength) INFO+='\nBytes: '+Number(VID.contentLength).toLocaleString().toString();
INFO+='\n\n'+VID.mimeType+' (itag '+VID.itag+')';
INFO+='\n\n'+VID.url;
INFO+='\n\nOPEN URL?';
if (prompt(INFO, VID.url)) open(VID.url);
}
catch(e){alert(e);}[
=============================

(Am testing this in KM by copying the plain JS code into clipboard, then Edit > TEST injectJS
Needs macro testinjectcode)

This works now in the Classic View and in that messy white-gray "modern" view I get with modern FF useragent.

My plan was to use the much lighter MOBILE view, but sadly it contains no direct download links anymore, only RTSP:// :-(
A first test shows I can get it playing in VLC, but would greatly prefer to download the videos quickly for later watching, when having more time. Perhaps downloading works too with VLC (convert/save option), but seems to run only in 1:1 speed, yikes. But was only a very quick first check, have to check it out deeper some day.



Edited 2 time(s). Last edit at 02/29/2020 08:47AM by siria.

Options: ReplyQuote
Re: Download YouTube Videos as MP4
Posted by: JohnHell
Date: February 29, 2020 03:19PM

Quote
siria
First draft success! Finally got that mysterious JSON-stuff working to read the video URL and properties, and shows it as info alert.
The only prob is this method only works in KM74 or newer, but KM1.6 seems too old for multiple nested jsons in jsons and even with arrays in between. Will have to crop out a smaller chunc somehow.

What?

The original script works/worked on 1.6, does the double JSON.parse and everything. I even told here, in the previous page. So, I don't get what are you trying to do

I guess is because you want to make it work your own way or something.

Quote
siria
My plan was to use the much lighter MOBILE view, but sadly it contains no direct download links anymore, only RTSP:// :-(

It is what I tried to tell you. That in mobile, there were a couple of options only.



Aside this, I haven't done anything about this script but extract and fiddle with the JSONs of different pages for later use. As said, these weren't the best days to take hands on it.



Edited 2 time(s). Last edit at 02/29/2020 03:22PM by JohnHell.

Options: ReplyQuote
Re: Download YouTube Videos as MP4
Posted by: anonymous
Date: February 29, 2020 05:41PM

Siria's new script works in old KM 1.6 and KM 1.7 clones using UA FF45. Injecting flash object tags may allow playback.

Options: ReplyQuote
Re: Download YouTube Videos as MP4
Posted by: siria
Date: February 29, 2020 09:40PM

@JH: glad you're having fun with a bloody JS-beginner learning new stuff tongue sticking out smiley As I told you before a few times, JS feels completely anti-natural to me and that's not going to improve anytime soon. But when fiddling with scripts for macros I need to understand what it does and why and how. Yes it may all be in the giant original script already, but that's too complicated to fully understand, so at the moment the plan is trying to invent the wheel again with a much smaller, simpler script.... first adding normal links, and later may try to wrap it into a html5 video tag.

anonymous said:
> Siria's new script works in old KM 1.6 and KM 1.7 clones using UA FF45.
> Injecting flash object tags may allow playback.

Oh right, now it suddenly works in KM1.6 too! Great :-) And even with all views?!
Just sIightly confused why it works now but did not yesterday... but better as vice-versa :-)
Not sure what you mean with Flash? They say Youtube delivers no flash at all anymore...

============== DRAFT-2, adds download LINK on top of page ===============

(function() {
try{
var x=document.getElementById('player-mole-container');
if (!x) var x=document.getElementById('player-wrap');
x=x.innerHTML.toString();
var y=x.split('ytplayer.config = ')[1];
var z=y.split(';ytplayer.load =')[0];
var JON1=JSON.parse(z);
var JON2=JSON.parse(JON1.args.player_response);
// SIZE: formats are in array, needs loop to check which one is which size?
// **USERCONFIG** Currently in classic view [0]=360p (itag18) and [1]=720p (itag22)
var VID=JON2.streamingData.formats[0];
var TIT=JON2.videoDetails.title;
var LinkTXT=VID.quality+' '+VID.qualityLabel+' / '+VID.width+' x '+VID.height+' px';
LinkTXT+='<br>Duration in sec: '+JON2.videoDetails.lengthSeconds;
if (VID.contentLength) LinkTXT+='<br>Bytes: '+Number(VID.contentLength).toLocaleString().toString();
LinkTXT+='<br>'+VID.mimeType+' (itag '+VID.itag+')';
var VidLink=document.createElement('a');
VidLink.setAttribute('href', VID.url);
VidLink.setAttribute('download', TIT);
VidLink.setAttribute('style', 'overflow: auto; position: relative; display: block; z-index: 9999999; padding: 10px;');
VidLink.innerHTML=LinkTXT;
var BODY=document.body;
BODY.insertBefore(VidLink, BODY.firstChild);
}
catch(e){alert(e);}
})()



Edited 4 time(s). Last edit at 03/01/2020 11:38PM by siria.

Options: ReplyQuote
Re: Download YouTube Videos as MP4
Posted by: anonymous
Date: March 01, 2020 12:29AM

@siria
DRAFT-2 works too, but our old KM 1.x versions are different. Site archives may have the removed lines for flash players. Newer browsers can inject a video element for an internal player.

Options: ReplyQuote
Re: Download YouTube Videos as MP4
Posted by: siria
Date: March 01, 2020 01:41AM

Quote
anonymous
DRAFT-2 works too, but our old KM 1.x versions are different. Site archives may have the removed lines for flash players. Newer browsers can inject a video element for an internal player.

Thanks for confirmation, good to know, especially regarding younger browsers as mine.
I understand what you mean with trying to restore a former yt object tag for old browsers, but the flash videos are not available anymore from youtube servers, no matter how, zero tricks (acc MSFN) Should I put an mp4 into the object? But would that play? It needs plugins, which must probably be enabled at browser start already? Flash was not so bad at all, since it could be blocked by default and enabled only temporarily during session, and was very friendly to ressources. That's another concern, the heaviness of playing directly in old browsers on old machines.

Options: ReplyQuote
Re: Download YouTube Videos as MP4
Posted by: anonymous
Date: March 01, 2020 02:18AM

@siria
Rarely used that site and maybe the default was flv, but there was a way to play mp4 in browsers at that time.

Options: ReplyQuote
Re: Download YouTube Videos as MP4
Posted by: fredv
Date: March 01, 2020 09:39AM

@siria

Sometimes I download with youtube-dl to play it offline, not tried it but it can merge to mp4.
For playing a (youtube) video I made a small macro to play a url with mpv.
I added the macro, it's a copy of something else and changed it a bit, you are much better in this smiling smiley

Attachments: mpv.7z (752 bytes)  
Options: ReplyQuote
Re: Download YouTube Videos as MP4
Posted by: JohnHell
Date: March 04, 2020 01:21AM

Sorry for the delay people.

Between lack of time, and even being able of strip down to half of the size of the original code, there is a lot reverse engineering in the code to understand why it was done that way in some code portions and also I have to find out what can I extract from here and there from the YT code and how I can improve it, as there are several things that are not needed anymore and to find out involves a lot of back and forth with the reversal engineering. Also, as old it is the code, "lacks" some other things.

Believe me that if it weren't worst I'd almost rewrite it (but my way would be crude (I don't like fancy)), but most is already done, more or less done. As I said, it needed a total revamp. I could even share my personal fix, but would only work with JavaScript off and is buggy, as a quick fix it is.

There is also the issue that the displayed HTML differs from JavaScript enabled and disabled browsing behaviour. And if it weren't enough, and I can't test it as I'm not using the latest K-meleon (aka latest rendering engine), now YouTube, and that is the reason the page weights 2MB, serves several HTML versions in one by the template tag (HTML5 tag) which hides the no used, but that, as we are seeing makes the page get bloated (ultra bloated, I'd say, because there are quite a few YouTube template/interfaces options). Basically is a duplication of the markup several times and choose which one is the best depending on the client of the visitor. And thank god that markup hasn't actual content, or would be worst. Sadly, is the way most sites work today. Instead serve a page, all the load is delegated to the client and pure JavaScript computation to build the page.


In other words, it will be available when it will be, but I had the feeling to explain what happens if someone is waiting for the code. As said earlier, use the downloading pages for download them while there isn't any update. Or use siria's code. Whatever you want.

P.S.: Siria, I wasn't having fun of you. I'm amateur, not an expert, remember winking smiley



Edited 1 time(s). Last edit at 03/04/2020 01:22AM by JohnHell.

Options: ReplyQuote
Re: Download YouTube Videos as MP4
Posted by: JohnHell
Date: March 04, 2020 10:54PM

I know what I said above, but I'm re-writing it almost completely, patch after patch.

It is starting to be so frustrating to patch here and there, but when you want to do something "advanced" to avoid relying on other things, all is limiting.

In the end it will be more like the siria's code. It would have been my wish from the beginning and I hoped to reuse most of the code but... no way... nooooo way. This is going to be for K-meleon, for newer standards/browsers and it is dumb to keep old methods to be compliant for non-existent browsers and more than this, with Greasemonkey (but I'm trying to keep compatibility with 1.x).

This doesn't mean it will be delayed more or less, but you know, it is a revamp. Kudos to the original coder/maintainer but this can't be maintained anymore.



Edited 2 time(s). Last edit at 03/04/2020 10:55PM by JohnHell.

Options: ReplyQuote
Re: Download YouTube Videos as MP4
Posted by: JohnHell
Date: March 07, 2020 12:27AM

Consider it a beta
http://kmeleonbrowser.org/forum/read.php?9,142050,142050#msg-142252

I broke the order display with the max option and I won't fix it. It is, or make it dynamic and show any available format, or add an array manually edited, that is pure madness, to keep a list of sorted quality options. It is not my fault if YouTube doesn't number the quality ascending, nor JavaScript provides any method to get an Object properties UNSORTED (really, I can't believe this is not possible, when on the net you find the opposite, people complaining in the past that the properties got unsorted...; the world upside down).

Most of the code is now commented (I won't say half of the code is comments, but almost, it is for coders sanity after all reverse engineering it) as I don't even think of do a rework myself alone.

Should be compatible with the new and old interface, even though IT IS NOT INTENDED for the old layout.

But, the new layout, if it doesn't render (old engine) won't display, I mean, it will display correctly, but very differently from JS off and JS on. The body just sucks...

I have no clue how it will look if the page renders correctly on newer browser engine. Really, no clue. Haven't tested (old KM engine), haven't seen it, haven't any intention either. I browse it without JavaScript Off, so, who cares?. I don't care.

In other words, works for me.

It is also compatible with K-meleon 1.x, or 1.6, I don't remember which Gecko version has each.

And... mmmm I don't know, I might forget something else. I'm tired of this shit code, of this shit YouTube, of these forced web standars.

Oh, siria, the history works by changing the title. Maybe that issue is only on 1.6, but I don't know, on 1.6 it still displays the old layout.

I forgot to say that, as the original script, it won't show downloads for Copyright protected videos or similar. So that doesn't mean it doesn't work. I thought of adding a warning (that you can see in the code), and maybe study add the decryption method using the old code, but I think it is beyond me and I don't think it will work if didn't in the past.



Edited 2 time(s). Last edit at 03/07/2020 02:35AM by JohnHell.

Options: ReplyQuote
Re: Download YouTube Videos as MP4
Posted by: siria
Date: March 07, 2020 02:29PM

Yep, works in KM1.6 too, thanks.
And very good idea to include code comments for other users :cool:

Quote
JohnHell
nor JavaScript provides any method to get an Object properties UNSORTED (really, I can't believe this is not possible, when on the net you find the opposite, people complaining in the past that the properties got unsorted...; the world upside down).

No clue if applicable here, just always a prime suspect for "mysterious" loop results:
your script uses a "for-in" loop, a method lots of stackex topics call problematic in most cases, aside from being slow too. It can produce more or less different results as simple numbered loops through x.length, which only create normal arrays. Perhaps check if it's possible to replace it, and if it changes anything?
Can definitely confirm from several own macro-scripts in the past that results can turn out not just slightly, but even completely different for both methods! Just recently yet again. Not to mention the speed if really huge tasks.

Quote
JohnHell
I forgot to say that, as the original script, it won't show downloads for Copyright protected videos or similar. So that doesn't mean it doesn't work. I thought of adding a warning
(.....)
I don't think it will work if didn't in the past.

Just curious, have an example link?
Have been considering for my own script to show warnings if downloads are forbidden or whatever, after noticing some interesting words in the json, like isCrawlable, isPrivate, playabilityStatus, projectionType.... But have no test link to figure out what those may mean exactly.

And as I know you, you won't need this, but perhaps future readers may find it interesting too, a very detailed yt-analyzing page I stumbled across yesterday:
https://tyrrrz.me/blog/reverse-engineering-youtube/



Edited 1 time(s). Last edit at 03/07/2020 02:37PM by siria.

Options: ReplyQuote
Re: Download YouTube Videos as MP4
Posted by: JohnHell
Date: March 07, 2020 04:40PM

Quote
siria
No clue if applicable here, just always a prime suspect for "mysterious" loop results:
your script uses a "for-in" loop, a method lots of stackex topics call problematic in most cases, aside from being slow too. It can produce more or less different results as simple numbered loops through x.length, which only create normal arrays. Perhaps check if it's possible to replace it, and if it changes anything?
Can definitely confirm from several own macro-scripts in the past that results can turn out not just slightly, but even completely different for both methods! Just recently yet again. Not to mention the speed if really huge tasks.

Sadly, is not that way:
https://medium.com/backticks-tildes/iterating-through-javascript-objects-5-techniques-and-performance-tests-42b4a222a92b#3916

And For in is the only one compatible with 1.6 for iterate on Objects properties, anyway. And yeah, I added a method to use the other with other engines versions and there isn't any difference.

Anyway, after several reads (yeah, I wasted quite a lot of time researching), from ECMAScript 5 all changed and now all is sorted (there is no need to use the sort() function). As 1.6 uses an older ECMAScript version, probably that is the reason you see different results. Sadly, at least on Gecko 31 (from K-meleon 75), is not the case.

If I'm wrong, and you find a fix for all K-meleon version, please, add it yourself or post it here.

The sorting of the qualities, in the end, is not... a priority unless you really, really, really, want to download the dash formats only, and the full quality of each, and use then ffmpeg (not compatible with all OSs version, even special compiled versions) to join the streams, because is the only way. And if the time comes and they stop offering the 360p and 720p (video+audio), then I'd consider re-implement a manual array.

As said, I opted this way, as commented in the script for easiness on maintain it in case of new formats. As said, is not my fault if the YouTube numbering isn't ascending with quality nor the ECMAScript sorting behaviour.

If anyone prefers a fixed array with qualities sorted manually, just remove any reference to updateQualities() function and the "else" conditional that later invokes it to update the array if new format is found.

Quote
siria
Quote
JohnHell
I forgot to say that, as the original script, it won't show downloads for Copyright protected videos or similar. So that doesn't mean it doesn't work. I thought of adding a warning
(.....)
I don't think it will work if didn't in the past.

Just curious, have an example link?

Have been considering for my own script to show warnings if downloads are forbidden or whatever, after noticing some interesting words in the json, like isCrawlable, isPrivate, playabilityStatus, projectionType.... But have no test link to figure out what those may mean exactly.

Dumb music
https://www.youtube.com/watch?v=aBPw0NczboA
A normal song to compare, but both copyrighted
https://www.youtube.com/watch?v=aEb5gNsmGJ8

Instead an url the JSON has a cipher property where it is the signature to decrypt and the url. That is the difference with normal videos.

In the script the "warning" I planned can be found by the copyright word.

Quote
siria
And as I know you, you won't need this, but perhaps future readers may find it interesting too, a very detailed yt-analyzing page I stumbled across yesterday:
https://tyrrrz.me/blog/reverse-engineering-youtube/

Outdated. For copyright material, for example, there isn't any manifest. Now is all on cipher property. 3 years on such data on Internet is a decade in real life.


But, to leave this clear like water. Unless someone makes it, or I'm sooooo bored I try it and I accomplish, this script WON'T allow copyrighted downloads. Not because I'm against it, just because I'm not going to waste my time in a feature that may change continuously and that video download pages such as savefrom.net offers it without any hassle and earning money, what I'm not.

And I don't have the knowledge, if someone doubts about it. Let's leave this to the crackers.



Edited 4 time(s). Last edit at 03/07/2020 05:29PM by JohnHell.

Options: ReplyQuote
Re: Download YouTube Videos as MP4
Posted by: siria
Date: March 07, 2020 07:48PM

JohnHell said:
> Instead an url the JSON has a cipher property where it is the signature
> to decrypt and the url. That is the difference with normal videos.

Okay, have found it.
So the absence of [url] and presence of [cipher] could by used to check, for simply showing a hint to the user that this video is copyrighted or otherwise protected.



Edited 1 time(s). Last edit at 03/07/2020 07:50PM by siria.

Options: ReplyQuote
Re: Download YouTube Videos as MP4
Posted by: JohnHell
Date: March 07, 2020 09:03PM

Yes, but I haven't done to avoid rewrite the list construction. And the method I left commented would add the options but with a warning text. But I found unnecessary.

For any one, if there isn't a download button, assume the videos can't be downloaded or there isn't anything able to be downloaded. After all, they are copyright protected. Use web pages specialized on the task.

Now even bitdownloader.com, that you recommended here, and I was relying on to, doesn't offer the option to download when it finds is a copyrighted video...



Edited 1 time(s). Last edit at 03/07/2020 09:04PM by JohnHell.

Options: ReplyQuote
Re: Download YouTube Videos as MP4
Posted by: JohnHell
Date: March 07, 2020 11:40PM

Maybe I misunderstood the whole thing.

It sorts only properties parseable as numbers.

In my opinion should be or all or nothing, so, I added text and now are not parseable as numbers and the formats are easier to maintain (despite I had to change the code where needed). Just add one in the correct position with the an "i" in front. Itag "18" becomes "i18".

Options: ReplyQuote
Re: Download YouTube Videos as MP4
Posted by: JohnHell
Date: March 10, 2020 05:51PM

Come on...

Fix for file size guessing. They have removed the length in the video description and now is only left on audio description :/

Might be related to the changes made yesterday. On Seamonkey, some times it was the old layout, later the new, later the old. By the way, if anyone is interested, on Seamonkey 2.49.5 (Gecko 52/Firefox 52), with Windows XP SP2 requirement, the new layout performs well. I can't tell about the creator studio because it shown only the old layout.



EDIT: Oh, oh, there are some formats that are not downloading..., set up as blah,blah,blah, FORMAT_STREAM_TYPE_OTF



Edited 2 time(s). Last edit at 03/10/2020 06:02PM by JohnHell.

Options: ReplyQuote
Re: Download YouTube Videos as MP4
Posted by: JohnHell
Date: March 19, 2020 06:49PM

Maybe is happening only to me..., or might be what you already know and to save bandwidth (maybe they find now the pointless of serving 8MB of files instead just 2.5Mcool smiley, but YouTube seems has switched to the old layout again and I've seen a little glitch.

As views counter is in absolute position (:-?) the Download arrow/text placement moves it down. If you don't find it annoying (mixes visually with hands up/down, but not its functionality) I'm not going to fix it. After all, they will change back soon or later, and isn't something critical, at least for the functionality of the download itself, that is the point of this script.

If you really, really, really find it annoying, you can replace...

+((textDirection=='left')?5:10)+'px;}

with...

+((textDirection=='left')?5:10)+'px; display:inline-block!important; height: 15px;}

As said, isn't anything critical to the script functionality. It is just if it is annoying for you.



Edited 2 time(s). Last edit at 03/19/2020 08:48PM by JohnHell.

Options: ReplyQuote
Re: Download YouTube Videos as MP4
Posted by: JohnHell
Date: June 30, 2020 09:05PM

Back to new layout (oh god ) and new code, so new parsing fix. But this time looks that they learnt something and now the page is "only" ~450KB, not the 2MB monster.

Download again.

- A little fix to support old layout too by using this tip:
http://kmeleonbrowser.org/forum/read.php?3,152593,152669,page=1#msg-152668



Edited 1 time(s). Last edit at 06/30/2020 10:12PM by JohnHell.

Options: ReplyQuote
Re: Download YouTube Videos as MP4
Posted by: JohnHell
Date: July 12, 2020 11:48PM

A change to add the open version of the h.265 codec, AV1, formats and some style/id change.

I also removed the ratebypass parameter from the URL because it was useless. Maybe was useful in the past for DASH formats, but it isn't now. It does nothing.

Options: ReplyQuote
Re: Download YouTube Videos as MP4
Posted by: JohnHell
Date: November 06, 2020 11:12PM

Updated to warn unavailable downloads or missing script file.

Options: ReplyQuote
Re: Download YouTube Videos as MP4
Posted by: siria
Date: November 07, 2020 03:01AM

Confirm that the script works great in KM1.6, with minimum javascript allowed smiling smiley
(only needs inline JS, no external js-files needed, and as usual useragent must be set to anything semi-modern or Google kicks us out and redirects to a stupid old-brower-warning page)

But suffering again from itching-finger-syndrome, hard to resist

This code adds 2 user options on about:config, and allows optional installation in profile folder without trouble:

Quote
suggestion:

setpref(BOOL,"macros.downloadyoutubescript.pause",false);
setpref(BOOL,"macros.downloadyoutubescript.reset",false);

$_DLYTScode = "";

downloadyoutubescript_checkYT{
if (getpref(BOOL,"macros.downloadyoutubescript.pause") == false){
if (index($URL,"https://www.youtube.com/watch?v=") == 0){
if ($_DLYTScode == "") &_downloadyoutubescript_getfile;
if ($_DLYTScode > "") injectJS($_DLYTScode);
if (getpref(BOOL,"macros.downloadyoutubescript.reset")) $_DLYTScode = "";
}}}

_downloadyoutubescript_getfile{
$_file="Download YouTube Videos as MP4.user.js";
# If you really want to keep the JS-file in a subfolder:
$_file="downloadyoutubescript\\".$_file;
$_DLYTScode = readfile(getfolder(UserMacroFolder)."\\".$_file);
if ($_DLYTScode == "") $_DLYTScode = readfile(getfolder(MacroFolder)."\\".$_file);
if ($_DLYTScode == "" ) {
$_x = promptforfile(getfolder(MacroFolder),$_file,"Download*.js");
if ($_x) $_DLYTScode = readfile($_x);
else setpref(BOOL,"macros.downloadyoutubescript.pause",true);
}}

$OnLoad = $OnLoad."downloadyoutubescript_checkYT;";
$macroModules=$macroModules."downloadyoutubescript;";

PS: the kmm-header still claims that KM75 were needed,
and that the macro and script were still version-1 from 2017



Edited 3 time(s). Last edit at 11/07/2020 03:21AM by siria.

Options: ReplyQuote
Re: Download YouTube Videos as MP4
Posted by: JohnHell
Date: November 07, 2020 03:40AM

Quote
siria
PS: the kmm-header still claims that KM75 were needed,
and that the macro and script were still version-1 from 2017

Probably. I just added the superfluous code

Defeats the purpose of the instructions. "Drop the files in the K-meleon macros root folder" .

I'd do tomorrow, I hope. I don't know what I'm doing here yet. Oh, yes, that damn BSOD I had broke my night.



Edited 1 time(s). Last edit at 11/07/2020 06:00PM by JohnHell.

Options: ReplyQuote
Re: Download YouTube Videos as MP4
Posted by: win2kfan
Date: November 13, 2020 04:06PM

Thanks for this great macro, it works like a charm :cool:

But I still need a video player that can stream the mp4-file (vanilla Win2k SP4Pro) so that I don't have to download it in advance.

MPC-HC says it can't render the file when I open the URL directly...

Options: ReplyQuote
Re: Download YouTube Videos as MP4
Posted by: JohnHell
Date: November 13, 2020 07:21PM

Quote
win2kfan
MPC-HC says it can't render the file when I open the URL directly...

I can't talk about players, because I [prefer to] download before play but make sure that it is not a dash URL (those that are video or audio only) for full compatibility.

The other option, VLC, SMplayer; but I don't know, for the first, which was the latest version compatible with Dash format and/or youtube and Windows 2000, and, with the second, if it even was compatible with Windows 2000 on any version.

As said can't talk/help myself about desktop players and YouTube. No experience, to be fair.

Options: ReplyQuote
Re: Download YouTube Videos as MP4
Posted by: siria
Date: November 13, 2020 08:48PM

Looks like I can send Youtube mp4-links to VLC (v2.0.5), but only as HTTP links, not httpS. Otherwise only error.
Catch:
Simply removing the "s" doesn't work here. My old VLC on yet older system can only run originally created http-links by youtube, when using UA of IEMobile9, but that also produces MobileView, what this script can't handle yet.
Have compared URL-parameters, but quite some differences, given up for now.
For example normal links contain "&requiressl..." (2x), and http-links not, but removing that is not enough either. I think the original huge script had mentioned "requiressl" in options somewhere, but not sure anymore. There must be more keys involved though, and not sure if it's possible at all this way.

Options: ReplyQuote
Re: Download YouTube Videos as MP4
Posted by: JohnHell
Date: November 13, 2020 09:34PM

Quote
siria
I think the original huge script had mentioned "requiressl" in options somewhere, but not sure anymore.

Nop:
https://web.archive.org/web/20160121123600if_/https://raw.githubusercontent.com/gantt/downloadyoutube/master/script/yt.user.js

Quote
siria
There must be more keys involved though, and not sure if it's possible at all this way.

There are, there must be. Fiddling with parameters does nothing.

That is the reason I removed the "injection" in the final URL of the "ratebypass=yes" parameter that was supposed to work by making DASH formats to download at full speed, but that long ago stopped working. By the time of the script, indeed, around 2016-2018.

Options: ReplyQuote
Pages: Previous12345Next
Current Page: 3 of 5


K-Meleon forum is powered by Phorum.