Signature missing

Dec 21, 2013 at 5:06 PM
For some Vevo videos(all) and a lot of official channels and their videos like http://www.youtube.com/watch?v=Z6FPJOgfCkc the uri generated by your toolkit has not the signature key. (&signature="") I investigated about that and I found this..

In a normal video like http://www.youtube.com/watch?v=93GuC1dMkxc uploaded by a normal user I can watch the video with the signature.
But in official channels that signature is missing.
Dec 31, 2013 at 12:40 PM
Edited Dec 31, 2013 at 12:44 PM
If you have the source code just check the Youtube.cs file and look for "else if (key == "sig")" in the code and extend it to check for "s" as well so that 'else' should look like this:

else if (key == "sig" || key == "s")


Update:
Interestingly enough that particular video has the "sig=" key so i wonder why the signature is missing...... it works here tho.
Dec 31, 2013 at 4:46 PM
Dec 31, 2013 at 6:46 PM
same here. I see URL with signature for vevo video (after I made changes as suggested by johnwrnd) but video doesn't play.
Dec 31, 2013 at 8:04 PM
Edited Dec 31, 2013 at 8:07 PM
Yes, i'm having the exact same problem here and even went as far as re-assemble the url myself manually without success... sadly i'm not that experienced with the youtube API so i hope rico can get some free time soon and have a look.
RicardoPons:
Glad it worked(i'm not the author of the toolkit tho.)... a small suggestion... don't post generated urls here or somewhere on the internet in public. The reason for that is because in the link you expose your IP which i bet isn't something you want to make public so be more careful with that ;)
Jan 9, 2014 at 5:40 PM
anybody figured out the solution?
Mar 5, 2014 at 9:05 PM
any luck with vevo videos? anyone :) ?
Coordinator
Mar 5, 2014 at 9:11 PM
Ill look into it tomorrow, maybe i find a solution...

do you have a sample youtube id?
Mar 5, 2014 at 11:54 PM
thanks rsuter!!!
http://www.youtube.com/watch?v=O-zpOMYRi0w
or any vevo video.
Mar 7, 2014 at 9:29 PM
Hey rsuter! did you get a chance to look into this? just checking..thanks for your help again.
Coordinator
Mar 7, 2014 at 11:44 PM
I hope i have time to look into this this weekend... Had lot todo at work
Coordinator
Mar 8, 2014 at 2:21 PM
Ok, ive tested it and this youtube id works for me in the WP8 emulator and as W8.1 application... It must be something with your internet connection/provider, which is blocked by youtube (video not available in your country?).
Coordinator
Mar 8, 2014 at 2:25 PM
Checkout newest version and try it in the sample applications: https://xp-dev.com/svn/mytoolkit
Mar 10, 2014 at 9:39 PM
ok thats weird. I am in USA and have good internet connected. I have tried from multiple places (home/work). I am using MyToolkit 2.0.14. Is newest version you pointed out is different? In any case I will try out sample application sometime today and will update you. thank you!
Coordinator
Mar 10, 2014 at 11:46 PM
Hmm, maybe its different in the svn but i dont think so.. Its strange.. Are vevo videos live? Is this the same?
Mar 12, 2014 at 12:42 AM
Edited Mar 12, 2014 at 1:29 AM
no Vevo videos are not live. How do I download project from xp-dev?
Coordinator
Mar 12, 2014 at 7:26 AM
Install http://tortoisesvn.net/ then right-click on an empty directory and checkout the svn repository. Now you can always get the latest version with right-click and update...
Mar 13, 2014 at 1:39 AM
Thanks! I tried your sample application. VEVO videos doesn't work :(. it just shows progress bar and then blank gray area. other videos works. example video I tried is "JF8BRvqGCNs".
Coordinator
Mar 15, 2014 at 9:31 PM
Fixed in newest nuget package.
Coordinator
Mar 15, 2014 at 9:31 PM
Mar 16, 2014 at 8:58 AM
thanks for quick turnaround! I installed latest package but now I see compile error
Error 2 Payload file \packages\MyToolkit.Extended.2.1.1.0\lib\netcore45\MyToolkit.Extended\Controls\DatePicker.xbf' does not exist.
and few more for theme and UI folder under MyToolkit.Extended.2.1.1.0\lib\netcore45
Coordinator
Mar 16, 2014 at 10:13 AM
Ok, should work now v2.1.2
Mar 16, 2014 at 9:27 PM
Edited Mar 16, 2014 at 9:27 PM
fixed! things works! you rock!
Coordinator
Mar 16, 2014 at 9:28 PM
Finally, :)
Jun 21, 2014 at 5:47 AM
seems like youtube broke it again :(.
Coordinator
Jun 25, 2014 at 2:29 PM
Can you give me a YouTube ID which is not working?
Jun 26, 2014 at 1:13 PM
VEVO videos doesn't work

Some ID: 7-7knsP2n5w ; TGtWWb9emYI ; Otx7FEINUds
Jun 28, 2014 at 11:55 AM
Hy, first thank you for lib :)
also me dosn't work more link, used last version code update by nuget,
for example this link kPsd2XaBKzc
can resolve? thank's
Jun 29, 2014 at 1:50 AM
magically videos started working again. not sure why/how :)
Jun 29, 2014 at 9:37 AM
Edited Jun 29, 2014 at 9:41 AM
For me no, i have the same problem with many video ,
anyone can try link kPsd2XaBKzc and told me if someone can see ?
i think that the problem is the advertaising, the video that have this retriving a link that doesn't work
tks and please help :)
Coordinator
Jul 1, 2014 at 3:18 PM
Just enhanced my unit tests and they work flawlessly:
    [DataTestMethod]
    [DataRow("kYQ8w7kxdDk")]
    [DataRow("J3UjJ4wKLkg")]
    [DataRow("93GuC1dMkxc")]
    [DataRow("O-zpOMYRi0w")]
    [DataRow("JF8BRvqGCNs")]
    [DataRow("kPsd2XaBKzc")]
    [DataRow("Otx7FEINUds")]
    [DataRow("TGtWWb9emYI")]
    [DataRow("7-7knsP2n5w")]
    public async Task When_loading_video_then_uri_it_should_be_available(string youTubeId)
    {
        //// Act
        var uri = await YouTube.GetVideoUriAsync(youTubeId, YouTubeQuality.Quality360P, YouTubeQuality.Quality2160P);

        //// Assert
        Assert.IsNotNull(uri);
        Assert.IsTrue(uri.HasAudio);
        Assert.IsTrue(uri.HasVideo);
    }
I'm testing in Switzerland. Are these unit tests successful on your machine? (Checkout https://xp-dev.com/svn/mytoolkit)
Jul 1, 2014 at 4:11 PM
Edited Jul 1, 2014 at 4:16 PM
Facing same problem for some of the videos (kPsd2XaBKzc for example as meant), the generated url's HasAudio and HasVideo properties are true but when I try to download through that url, error code 403 is returned by youtube. And by the way, thanks for your support and great work, I highly appreciate it.
Edit: Didn't realise that you were already onto that issue in another topic, sorry
Coordinator
Jul 1, 2014 at 4:38 PM
kPsd2XaBKzc works for me in Switzerland (got URI and played it in VLC player as network stream). Do the unit tests fail for you (checkin from 1830)?
Jul 1, 2014 at 6:12 PM
Edited Jul 1, 2014 at 6:12 PM
Yes, same situation occured in When_loading_video_then_uri_it_should_be_available function; Additional information: HTTP error 'Forbidden'. I can Access the video from youtube itself, but can not reach the stream by the generated URI :/ Does it have any point if we try the URI generated in your network for that video?
Coordinator
Jul 1, 2014 at 7:19 PM
I think this will not work because the url is bound to the ip... And also it cannot be implemented later... To investigate the problem you should use VPN to get ips of different countries...
Jul 1, 2014 at 8:22 PM
You are definitely right, I've tried the URI with a VPN turned on, it is working well. But I can't get the reason behind why they are blocked for some countries, even while we are able to access those videos directly from youtube..
Coordinator
Jul 1, 2014 at 8:30 PM
Then you have to debug the youtube class source code and check the signature generation, maybe they changed something with the javascript code...
Jul 1, 2014 at 8:42 PM
Edited Jul 1, 2014 at 8:44 PM
Thanks for the advice. And one last question, does a valid URI (that is accessible from my country) have to exist (or should be possible to be generated) for all of the videos available through youtube?
Jul 2, 2014 at 1:18 AM
if it's a little help i see that all link doesn't work go in GenerateSignature(value, javaScriptCode); and exit without change in variable value (or signature) so.. maybe the javascript is change and the function doesn't found real signature (for other country like italy and i think other) ?
Coordinator
Jul 2, 2014 at 8:11 AM
Yes, that may be the problem. Ill do some debugging when i have time, but it may not work on my machine as the code may never be used in my country...
Jul 2, 2014 at 9:42 AM
perfect, when you can thank you very much to see, i continue my investigation and if i found some news i write immediatly, thank you very much for help i hope we can resolve ;)
Coordinator
Jul 2, 2014 at 10:29 AM
ok, ill check it after work.. maybe i can debug this method...
Coordinator
Jul 2, 2014 at 4:19 PM
The unit tests are successful on my machine AND call the GenereateSignature method... Can you post the content of the functionBody for a YouTubeID which is not working for you?
Jul 2, 2014 at 4:42 PM
i send a mail with javaScriptCode and s,
functionBody in my test is ""
told me if it not arrived mail :)
thank's a lot
Jul 2, 2014 at 4:45 PM
Edited Jul 2, 2014 at 4:48 PM
functionName is "", regex can't find matching string (or something like that) in my javaScriptCode, shall I send you the javascript code that was received by my machine?
Jul 2, 2014 at 4:57 PM
Edited Jul 2, 2014 at 5:00 PM
yes please
Jul 2, 2014 at 4:59 PM
Yes i see this, so i think that it's here the problem, but i don't know if in my javascript there is a real signature or not.
So yes please send your javascript so i see how it work ;)
Jul 2, 2014 at 5:44 PM
Sorry but i see that you contac me by CodePlex but doesn't see the attachment, if possible send javascriptcode by attachment email
Coordinator
Jul 2, 2014 at 6:43 PM
Just updated the YouTube class, improved the regex for finding the signature in the JS and now the function name gets correctly escaped... please try again...
Jul 2, 2014 at 7:12 PM
It's work !!! ;) very very very good work, thank you very much !!
Jul 2, 2014 at 7:20 PM
Omg, it is working now, thank you so much for your time, I am so grateful! And will you publish an update on NuGet?
Coordinator
Jul 2, 2014 at 7:57 PM
Ok, NuGet is live. Please test it and report here if its working...

Btw: And please review the project :)
Jul 2, 2014 at 8:32 PM
Working smoothly again, as intended. Thanks again for the great and rapid work.
Jul 2, 2014 at 8:40 PM
Edited Jul 2, 2014 at 9:18 PM
perfect work! Thank's a lot

PS: Certainly and with great pleasure ;)
Jul 17, 2014 at 3:41 AM
Not working with VEVO videos... Again...
Coordinator
Jul 17, 2014 at 7:00 AM
YouTube changed the algorithm for generating signatures again. Create a breakpoint in YouTube.GenerateSignature and run the unit tests. The new functionBody looks like this:

a=a.split("");a=go.XG(a,15);a=go.XG(a,44);a=go.NZ(a,66);a=go.XG(a,24);a=go.PL(a,3);a=go.NZ(a,51);a=go.XG(a,2);a=go.XG(a,50);return a.join("")

a is the signature parameter which gets transformed to the real signature...
We have to reverse engineer the javaScriptCode to know what go.XG, go.NZ, etc are doing.

Please post your code if you have found a solution.
Jul 17, 2014 at 11:06 AM
Edited Jul 17, 2014 at 11:13 AM
I have been checking the open source program called youtube-dl which is http://rg3.github.io/youtube-dl/. It is generating signature correctly now, can't we extract the solution from there?
Coordinator
Jul 19, 2014 at 9:56 AM
They are using a javascript interpreter which is not available in c#. I think we have to reverse engineer the js methods...
Jul 20, 2014 at 7:52 PM
Hy, anyone have found solution?
Coordinator
Jul 20, 2014 at 10:08 PM
Please check out the newest code from svn and try again..
Jul 20, 2014 at 10:26 PM
Thank's rsuter but i take the last code but test (When_loading_video_then_uri_it_should_be_available) give me "forbidden" on (for example) "xE2MxCv5vVY" link
Coordinator
Jul 21, 2014 at 7:33 AM
Ok not enough flexible.. Try again please :)
Jul 21, 2014 at 8:26 AM
Edited Jul 21, 2014 at 9:36 AM
Perfetc work :)
now alla video played ;)
thank's a lot :)


ps: sorry for the OT but I saw that youtube retrieves links with music only without video; is there a way in your lib to retrieves such a link?? thanks
Coordinator
Jul 21, 2014 at 9:44 AM
Ok, nuget update is live...
I think there is a method called geturis...
Jul 21, 2014 at 10:31 AM
perfect, i found, great :)
Jul 24, 2014 at 8:03 AM
Hy, i hope i'm wrong but i think that youtube another change signature link :(
Coordinator
Jul 24, 2014 at 10:10 AM
I have problems too, but i dont know if its because of my cell provider (in wlan it works) or a youtube problem... Do you have some sample yt ids?
Jul 24, 2014 at 11:03 AM
Edited Jul 24, 2014 at 11:05 AM
Yes, all vevo, like xE2MxCv5vVY
i try other program and all i see now have same problems, also dll posted vinou5
Coordinator
Jul 24, 2014 at 8:14 PM
Ok, the javascript code has slightly changed.. checkout the latest svn code and try again? Is it working again?
Jul 24, 2014 at 8:51 PM
Yes, now unit test working perfect ^_^ always thank's a lot ^_^
Coordinator
Jul 24, 2014 at 8:53 PM
Im not sure if unit tests are enough, they work on my dev machine but in my app i still have problems (cannot play this file).
Jul 24, 2014 at 8:57 PM
ok, now i take new dll and test in app ;)
Jul 24, 2014 at 10:10 PM
Edited Jul 25, 2014 at 12:02 AM
edit this post because i make other test and now, integrated direct project in my app, all link that i try working best, perfect ;)
Coordinator
Jul 25, 2014 at 10:09 AM
Maybe yt changed the used codec and the url or signature is not the problem?
Jul 25, 2014 at 12:54 PM
I don't know, i know that in italy, in app, your dll function perfect now
Jul 25, 2014 at 3:42 PM
Hi there ^.^". I'm a newbie to wp, so maybe i doing something wrong.. But I trying to play some songs from youtube and they don't work. Is it normal? ^^". Because any other videos can be played i my device. Oh yeah, it is Nokia Lumia 525. Maybe it is uncompatible with my device? Your code doesn't work for Vevo's and russian Ello's. But other music videos not loading too. I'm coding on wp 8.1 developer preview. Thanks for advice ^^
Coordinator
Jul 25, 2014 at 3:44 PM
Please post some youtube ids which are not working...
Jul 25, 2014 at 3:47 PM
Ok. Here are some : 0G3_kG5FFfQ , AqajUg85Ax4 , AF5WZ64bnIo . Ello video : ohfSspPiOF8 . And all id above are not working for me too :/ . Thank you
Coordinator
Jul 25, 2014 at 4:19 PM
Ok, update using NuGet to 2.3.5 and it should work...
Jul 25, 2014 at 5:47 PM
Perhaps, i have bad luck :D but the following code : var sr = await YouTube.GetVideoUriAsync("0G3_kG5FFfQ", YouTubeQuality.Quality480P); is not working for me :'D. I mean, it return Uri, but player don't show anything, and here's no sound :(
Jul 26, 2014 at 10:01 AM
I opened today my app, and it finally works. Really, don't know, what happened, but it finally works. Maybe, server was busy.. But , in any way, thank you very much ^^
Jul 26, 2014 at 3:14 PM
Edited Jul 26, 2014 at 3:34 PM
Can you please take a look at the following IDs that aren't working for me:

rSy0JtBCZMQ
AXaml3-qHRY
2MuOelMgRqQ

I tried to debug it a bit and I could not spot a "url=" in the response for the url_encoded_fmt_stream_map but I did see what appears to be a url so maybe something has changed.
Coordinator
Jul 26, 2014 at 4:13 PM
They are special... I currently dont have the time to fix all these problems... I already spent lots of houres to fix the latest problems... Some videos use rpme (drm protected), the others are missing the searched key (url_encoded...).
Jul 26, 2014 at 7:27 PM
Ok, thanks for taking a look. I figured they wouldn't be easy fixes.
Jan 15, 2015 at 1:25 PM
@rsuter Vevo videos has again gone nuts. It's the same issue function name is not catched. So the 'GenerateSignature' function goes wrong. Please have a look at it. It would be of great help.
Coordinator
Jan 15, 2015 at 4:25 PM
I already tried to fix this but the javascript has changed a lot. It's now like implementing a js interpreter and I currently do not have the time to do this. Maybe we can find an implementation of this yt parser in another language? Or maybe we have to find a completely different solutio (eg use a webview)?
Jan 15, 2015 at 10:50 PM
I understand, but applications like 'Hyper Tube' in Windows 8 and 'Tube HD' in Wp8 plays it smoothly. I was wondering how they are able to do it.

Sent from my Windows Phone

Coordinator
Jan 16, 2015 at 12:17 PM
Yes, maybe we can reverse engineer one of these apps to see how they are doing it
Jan 17, 2015 at 3:23 AM
Let me try that. But I have to start learning reverse engineering. Can you refer any useful links to start off? Meantime I'll search for it.

Thank you for suggesting Webview, I have updated my apps with that as of now. I'm in a critical situation where many users are suing for failed video playback. Thank god I got a response from you. I could donate for mytoolkit project, if I come over this situation.

Thanks,
Siva

Jan 17, 2015 at 5:38 AM

Hola! You guide me right and cool. Break through, I found YT link grabber file of HyperTube. But unfortunately it is a HTML app. Attached the file. I guess

function findSignatureCode(sourceCode) is responsible for finding the exact javascript function. I don’t know JS, but I’ll go through it meantime and try to adapt. If it is a quick job for please share updated YouTube.cs of toolkit.

Also I’ll try to get files of ‘Tube HD WP8’.

Thanks,

Siva

Coordinator
Jan 17, 2015 at 8:11 AM
Can you send me the file? mail at rsuter dot com
Jan 17, 2015 at 12:21 PM
Now the function name is '$s' that's it. Everything else is working cool. Thanks a lot.

Is your mail is : [email removed]?

Can you add on Skype: Sivakumarchellamuthu

Sent from my Windows Phone

Coordinator
Jan 17, 2015 at 2:21 PM
Ok, I think Siva and me have found a solution to this YouTube problem. Please try again with MyToolkit version 2.3.23 and report back if everything works or if there are still problems.
Jan 17, 2015 at 6:39 PM
Congratulations for the great work! It is working without any problems. But just to notice, I could make it work by downloading the zip version manually, nuget package didn't work (was failing as previous version), may be it was not updated properly (don't know if it was just me but i even tried removing nuget reference and reinstalling).
Coordinator
Jan 17, 2015 at 6:48 PM
That's strange, i'll check this tomorrow but it should be the exact same dll as the download...
Jan 17, 2015 at 7:13 PM
Edited Jan 17, 2015 at 7:13 PM
Well, the version property of nuget's dll says it is 2.3.23 but its size is same as 2.3.22.
Jan 17, 2015 at 8:36 PM
I also confirmed that in nuget version there is a problem like last version
Coordinator
Jan 17, 2015 at 9:04 PM
Sorry, it seems that I published the old version... Check out version 2.3.24, it should contain the latest code (just reverse engineered the DLL from the NuGet package and it's latest...)
Nov 12, 2015 at 1:17 AM
Signature missing again, any body got a fix?
Coordinator
Nov 12, 2015 at 7:44 AM
The project and issue has been moved to GitHub: https://github.com/MyToolkit/MyToolkit/issues/24
Nov 12, 2015 at 8:01 AM

Thank you Rico.