Page 1 of 4

youtube.lua -- Updated

Posted: 30 Jun 2013 17:19
by JSLover
youtube.lua -- Updated
...view the bottom of the script for the latest Changelog / Version History info.

How to use...
  1. Click the link above, then click Download, then Save it to...
    • <vlc-install-dir>\lua\playlist\youtube.lua
    ...<vlc-install-dir> being wherever you installed VLC to...for example, the default location...
    • C:\Program Files\VideoLAN\VLC\lua\playlist\youtube.lua
    ...or in my case, I remove "VideoLAN" from -- & add the version to -- the path...
    • C:\Program Files\VLC\2.0.5\lua\playlist\youtube.lua
    Note: You may notice a youtube.luac file already there, that should be fine -- save mine (youtube.lua, no c) next to it, don't overwrite (cuz overwriting would also rename the file you are downloading) -- I have both & my uncompiled version (.lua) is the one taking over. If you have conflicts, simply rename, move or (only in the most extreme cases) delete youtube.luac (notice the "c" on the end, it's ".luac"), leaving only my new youtube.lua in place.
  2. Go to YouTube & copy a video URL (or use this: youtube.com/watch?v=sXd2WxoOP5g, right-click on the link & click "Copy Link Location")
  3. Go to VLC & press Ctrl+V, then press Enter (or click Play) to confirm playing the URL.

Re: youtube.lua -- Updated for June 2013

Posted: 30 Jun 2013 19:24
by Chrisi22
Question - why is the path of either youtube.lua or youtube.luaC under "playlist?"

I'm sure I don't understand, but wouldn't that indicate it's only working for files in a playlist? What if one doesn't save files to the playlist?

Re: youtube.lua -- Updated for June 2013

Posted: 30 Jun 2013 20:19
by JSLover
Question - why is the path of either youtube.lua or youtube.luaC under "playlist?"
...as far as I know, it's a "playlist-modifying lua script", talking about VLC's playlist (not YouTube's)...you add a file to VLC's playlist (just by opening or attempting to play it) & when VLC starts to play it, all the files in the "playlist" directory get called, if any of those file's probe() function return true, VLC knows that that script wants to handle that playlist item.

If you move up a directory, to C:\Program Files\VideoLAN\VLC\lua, you see dirs like "http", "intf"...these are OTHER types of things lua scripts can integrate with -- I have not tested any of those yet.
...wouldn't that indicate it's only working for files in a playlist?
...perhaps that's true, but simply opening or attempting to play any file or URL adds it to the "Playlist" -- VLC don't call it "Now Playing", but that main Playlist -- even if just an unsaved temporary one -- is a playlist.
What if one doesn't save files to the playlist?
...no you don't need to save it to your own playlist for it to work, simply adding/playing a file puts it in the main playlist, which triggers the files in the playlist directory...so "it just works".

Re: youtube.lua -- Updated for June 2013

Posted: 01 Jul 2013 03:01
by Chrisi22
OK, that makes sense - sort of. That if save files in playlist is turned off, it's still putting the current file in the playlist, that probably then is deleted, after closing VLC.

If you're concerned about changing your user name (Re: your sig) - sometimes forum admins - not necessarily this one - will change it, if you give them a good reason.

Re: youtube.lua -- Updated for June 2013

Posted: 01 Jul 2013 20:51
by geostein8888
unfortunately the here posted urls are not working (view/download), is there somebody who can serve with the new youtube.lua, i could already finding out by myself, that he renamed the sig flag to s, but thats not all i guess.
Georg

Re: youtube.lua -- Updated for June 2013

Posted: 01 Jul 2013 21:19
by JSLover
unfortunately the here posted urls are not working (view/download)
...lol wut?...I'm here right now & my links are working! In fact, I was just Shift+Reload testing them, when I reloaded this topic & saw your msg about them not working.

What browser? What error msg?

Try Firefox, it works.

Update: I just used browserling.com & tested, Firefox, Chrome, Opera AND Safari work, but IE 9 says 404 (stupid IE!, Firefox is simply less of a headache)....Anyway: Fixed! (or "worked-around for now")

Re: youtube.lua -- Updated for June 2013

Posted: 02 Jul 2013 16:15
by Jean-Baptiste Kempf
Why not sharing a patch, seriously? This makes it quite hard to understand what is going on, tbh.

Re: youtube.lua -- Updated for June 2013

Posted: 03 Jul 2013 05:18
by geostein8888
you're right, now i can also view and download the script, what ever happend before now it works

Georg

Re: youtube.lua -- Updated for June 2013

Posted: 03 Jul 2013 20:19
by JSLover
Why not sharing a patch, seriously?
...the patch is my download...you download it & compare it to the current version & there's your patch. I could upload a literal *.patch file tho.

Or did you mean you wanted me to create a Trac account, file a bug & attach the patch there?...that requires creating a new account (meh!) & being at the mercy of people who won't approve of my patch. I'm releasing this to the Users & if you want it, you can have it too. But I'm not gonna play games with VLC devs not "approving" my patch or coding style (can't be link: wiki.videolan.org/Code_Conventions) (ooo nice it says "not enforced anymore"...perhaps I will write a patch!) -- or closing my bug & telling me I'll get banned if I reopen it (note: that wasn't me, but I don't want it to become me).
This makes it quite hard to understand what is going on, tbh.
...in my script, in the Changelog (at the bottom), I mention the project that showed me the code that needed fixed...
...if you go to the previous versions...
...& click on the most-recent "changes" link, you can see the most-recent things that dev had to change to keep it working (it's a diff).

This particular diff...
...is what was current when I found it & summarizes the changes...

Note that that userscript is in JavaScript (which is great!), but VLC only embeds Lua (which is horrible), so I have to read JavaScript (easy!) & attempt to write Lua (impossible...no hair left -- the Lua language doesn't seem to support ANYTHING, everything is 10 times harder to do in Lua -- or not supported at all!) to make this work...do you think that VLC could ever embed JavaScript?

In any case: the problem is that YouTube is Obfuscating the signature param. On some videos, the signature is given in the page source as sig=<whatever> (these are fine & work as-is), but on other videos it's given as s=<ahwterev>...I really do mean "ahwterev", instead of "whatever"...they "scramble" (obfuscate) the real sig & you have to unscramble (unobfuscate) it before passing it in the signature param for the real stream -- & depending on the length of the scrambled sig, they use a different scrambling algo.

OMG: Error msg while trying to Post/Preview this msg: "Your message contains too many URLs. The maximum number of URLs allowed is 4."...wow.

Re: youtube.lua -- Updated for June 2013

Posted: 03 Jul 2013 23:34
by Jean-Baptiste Kempf
The patch allows us to credit you correctly for your work and your copyright, that is the main reason. Moreover, it helps seeing the modifications :)

There is nothing fishy on that. You don't need to create a trac account, just provide a git diff or a diff -ruN or a git formatted patch.

Re: youtube.lua -- Updated for July 2013

Posted: 31 Jul 2013 07:19
by JSLover
Celebrating 1 month of fighting YouTube!!!

I just wanted to bump this, since it's been a month...& let the forum users know that I have been updating this...(is anyone using it?)
  • Check my forum signature & the download URL for the latest info.
I seem to NOT be able to edit the 1st post, I was gonna periodically update the title of this thread (it says "Updated for June 2013"). I knew that title would go out of date when I wrote it, but I assumed I'd be able to edit it. But apparently, there is an unseen "edit window" where you can't edit ANY of YOUR posts after a certain amount of time -- I'd like to see that lifted, but, if not, I'd at least like to push "one more" generic edit to the 1st post to remove any mention of "date" & point to the URL for the latest info.

Re: youtube.lua -- Updated for June 2013

Posted: 31 Jul 2013 12:52
by mederi
Thanks for the update. I can make a reasonable edit of your first post here. I think, that it is all right, just the title could be changed a bit. What new title do you suggest? "youtube.lua -- Updated playlist script"? Then you can provide actual information in your signature.
Regarding your user name, try to send a PM to Jean-Baptiste Kempf, whether he can change it for you. The Username is not anything that should be changed later by users themselves.

Re: youtube.lua -- Updated

Posted: 12 Aug 2013 10:51
by Lotesdelere
Thanks for the work but unfortunately it seems not to work with some videos:
http://www.youtube.com/watch?v=rfE5Zsw7QrI
http://www.youtube.com/watch?v=7Z5n1uPuw6E

Notice that the version from June is at least showing the title of the above videos in the status bar for a short while but recent versions don't display anything.

Re: youtube.lua -- Updated

Posted: 12 Aug 2013 15:19
by JSLover
What new title do you suggest?
...sorry for not responding earlier, but I couldn't really come up with an answer, the new/current title is fine. Or we could go with the title of the page I link to: youtube.lua — Play YouTube videos in VLC!...but really, I can't think of a good title for this forum topic. There's no way to say: "youtube.lua, oh not THAT youtube.lua, the OTHER youtube.lua".
...but unfortunately it seems not to work with some videos...
...I haven't pushed any change since Thu, Aug 8, 2013 --- 8/8/13, 3:19:19pm EDT (& of course, YouTube changed their code Thu, Aug 8, 2013 --- 8/8/13, 7:10:19pm EDT), so the current version shouldn't work -- YouTube was updating their obfuscation nearly every day (now it's been 4 days & they haven't changed it!!!), wearing me out, so I took a step back to write an Auto-Updater, which will hopefully be released soon. I can push my current version online, if people are actually using it (of course then YouTube will update their code again!). I haven't had much feedback on if people are really using it. Thx for the feedback, good to know it's being used...even if it didn't work at the time you tried, sorry for that.
...this video works on my current local version, but also it doesn't even say the signature is obfuscated. So it should just work anyway (with any version of youtube.lua). Does the video work when you go to YouTube directly?...or could it be blocked in your country? I tried again & it does say it's obfuscated, so I don't know what happened with the log (not telling me) the 1st time I tested it. Anyway, this will work with an updated version, whenever I release it (until YouTube breaks it again).
...I can't test this video cuz: The uploader has not made this video available in your country....but it is a VEVO video, so with the signature update (that I might push in a couple hours {or sooner, if I stop editing this post}), it should work.
Notice that the version from June is at least showing the title of the above videos in the status bar for a short while but recent versions don't display anything.
...it's set to fail early if it doesn't know how to deobfuscate a particular length of obfuscated signature. You can always open Tools -> Messages, before playing the video, to see what's wrong.

When you get the title of the Video, that means the script thinks it knows how to fix a signature with that length, but it could still fail, if YouTube has changed the algo for that sig length. When you don't even get the title of the video, the script knows that it can't decode that sig length & just fails on purpose instead of trying & then failing...so that's actually as designed.

Each version released was mostly to keep up with YouTube. Old versions should never work (except for non-VEVO videos, which should always work), since YouTube keeps being annoying (changing the obfuscation). The version online at the time of your post also was expected to not work, since I didn't push changes for a couple days.

Anyway, the Auto-Update script I have in the works should fix it: You would be able to set it to check every hour (or day) & it would auto-update the deobfuscation code.

Update: New version uploaded: Mon, Aug 12, 2013 --- 8/12/13, 10:19:19am EDT

Re: youtube.lua -- Updated

Posted: 12 Aug 2013 17:15
by Lotesdelere
Update: New version uploaded: Mon, Aug 12, 2013 --- 8/12/13, 10:19:19am EDT
Well done, with this one both videos are now playing fine :)

Re: youtube.lua -- Updated

Posted: 13 Aug 2013 16:56
by Jean-Baptiste Kempf
Not GPL anymore?

Re: youtube.lua -- Updated for June 2013

Posted: 15 Aug 2013 12:48
by Ludrax
Update: New version uploaded: Mon, Aug 12, 2013 --- 8/12/13, 10:19:19am EDT
Well done, with this one both videos are now playing fine :)
but for me they somehow are playing both on 2.0.8 and nightly with nothing replaced :?
Update: I just used browserling.com & tested, Firefox, Chrome, Opera AND Safari work, but IE 9 says 404 (stupid IE!, Firefox is simply less of a headache)....Anyway: Fixed! (or "worked-around for now")
IE10 also stupid?

Re: youtube.lua — Play YouTube videos in VLC!

Posted: 15 Aug 2013 18:19
by JSLover
but for me they somehow are playing both on 2.0.8 and nightly with nothing replaced :?
...depends on which video...
  • a non-VEVO (or otherwise "non-protected") video: should play no matter what (my youtube.lua or any youtube.lua)
  • a VEVO (or otherwise "protected") video: will only play with (the most-recent version of) my script, or an official updated youtube.lua script (but VLC Devs update slower)
...my script has the best chance of working, on more videos, on a day-by-day basis.
IE10 also stupid?
...Browserling won't let me test with IE 10...but yes, all versions of IE are stupid. No one should EVER use IE.

Re: youtube.lua -- Updated

Posted: 16 Aug 2013 03:36
by Ludrax
...I can't test this video cuz: The uploader has not made this video available in your country....but it is a VEVO video, so with the signature update (that I might push in a couple hours {or sooner, if I stop editing this post}), it should work.
this link will redirect us to above video
...depends on which video...
  • a non-VEVO (or otherwise "non-protected") video: should play no matter what (my youtube.lua or any youtube.lua)
  • a VEVO (or otherwise "protected") video: will only play with (the most-recent version of) my script, or an official updated youtube.lua script (but VLC Devs update slower)
...my script has the best chance of working, on more videos, on a day-by-day basis.
also depends on country because in some countries we don't see commercial before video on web player...

Code: Select all

access_http debug: protocol 'HTTP' answer code 403 access_http error: error: HTTP/1.1 403 Forbidden

Re: youtube.lua -- Updated

Posted: 23 Aug 2013 18:57
by Devilin Pixy
A lot of YouTube links seem to be unable to play through VLC giving me the error that it is unable to open the MRL. I was happy to find this post and hoped this file would fix the problem for 'protected' videos on YouTube. Not tried this fix before, but I assume this fix was working properly. Since I can't get it to work for 'protected' videos, my guess is that YouTube made some changes to the deobfuscation again ... sigh. Will there be another update for this youtube.lua?

Using: VLC 2.2.0-git-20130822-0403 Weatherwax with youtube.lua update: Fri, Aug 16, 2013 --- 8/16/13, 11:19:19am EDT

Re: youtube.lua — Play YouTube videos in VLC!

Posted: 25 Aug 2013 01:19
by JSLover
Will there be another update for this youtube.lua?
...yes, there will be...sorry, sometimes I just get lax on updating...

I also have an auto-updating version in the works (via another script {non-VLC}), but I haven't released it yet.

Re: youtube.lua -- Updated

Posted: 28 Aug 2013 12:24
by ajohnw
I just looked at the latest script. I run linux, opensuse and put the scripts in my local extensions folder. When I start vlc with any script like this one installed it complains about missing functions so far description(),activate() and deactivate().

Any ideas? There seem to be many scripts about that don't have these functions.

John
-

Re: youtube.lua -- Updated

Posted: 28 Aug 2013 12:30
by mederi
Put the youtube.lua in playlist folder, not in extensions, and replace (delete) the original youtube.luac there.

Re: youtube.lua -- Updated

Posted: 28 Aug 2013 14:26
by ajohnw
Thanks. I wasn't sure where that folder should go so searched the web and found a comment in an example script and created the directories. However when I looked in /user/etc there was a folder added called 5.1 which I assume relates to the version of lua I have installed. Added directories as per suggestion in the link of this and before it. Created the same thing off ~./local etc including the 5.1 directory. Still no joy. This is the link https://wiki.videolan.org/Documentation ... st_Scripts

I'm away for a few days so think I will start another thread rather than messing this one up.

John
-

Re: youtube.lua -- Updated

Posted: 29 Aug 2013 14:01
by mederi
Find "youtube.luac" in VLC in your computer and replace it with the new script "youtube.lua". That's it! Protected youtube videos (vevo) should play in VLC with this updated script.