Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Youtube Sep18 Sig changes #25

Merged
merged 1 commit into from Dec 25, 2018
Merged

Youtube Sep18 Sig changes #25

merged 1 commit into from Dec 25, 2018

Conversation

arjunae
Copy link
Contributor

@arjunae arjunae commented Oct 15, 2018

.... Forked the same repo a while ago and implemented the Signature change needed for youtubes sep18 base.js updates.
Feel free to use them too.

@ghost
Copy link

ghost commented Oct 16, 2018

360p and lower working

@sanishan
Copy link

anyone find a solution to work with HD video?

@mRYanna
Copy link

mRYanna commented Nov 15, 2018

@arjunae Youtube changed the cipher again. Can you edit this patch to comply those changes please. Thanks...

@arjunae
Copy link
Contributor Author

arjunae commented Nov 16, 2018

Yo: Confirmed. But as Youtube seems to change their stuff now on a regular, nearly Monthly base, i dont really feel that i like to do so. Here are some steps so anyone interested can use to find the new positions:

  1. start a youtube video - view html-source - search for the string /jsbin/player
  2. download or view above found player.js version :
    view-source:https://www.youtube.com/yts/jsbin/player-vflmQAIkc/de_DE/base.js
  3. begin at last youtube changes Position - which also introduced "yt.akamaized.net"
  4. look at the stuff called after : "d.set(b,(0,window.encodeURIComponent)(pL((0,window.decodeURIComponent)(c))));return d};"
  5. find && analyze the function names b, pL , c (eg search for stuff like bL=function)
  6. doin that, youll find
    pL=function(a){a=a.split("");oL.uD(a,31);oL.iZ(a,39);oL.uD(a,1);return a.join("")};
    which seems quite similar to what was called before the change:
    bL=function(a){a=a.split("");aL.jl(a,58);aL.NI(a,2);aL.l5(a,35);aL.NI(a,2);aL.jl(a,45);aL.l5(a,4);aL.jl(a,46);return a.join("")};
  7. havin verified the (otherwise meaningless) functions name as the decryption function- pL lets see whats changed in the function call in 4)
    d.set("alr","yes");c&&d.set(b,bL(c));return d};
    changed to:
    d.set(b,(0,window.encodeURIComponent)(pL((0,window.decodeURIComponent)(c))));return d};
  8. so all you need to do will be adapting the function names regexps $prefix, to reflect the changes made by yt in 7). The result should read pl instead of bl

Add: you will need to read into writeing regexps. but theres much easy to understand docs on the net so:
Happy Hacking!...

Add 2020: Interesting read: https://github.com/videolan/vlc/blob/master/share/lua/playlist/youtube.lua
PS: @Athlon1600: good job in rewriting the code in a clean manner.

@Athlon1600 Athlon1600 merged commit f8d0706 into Athlon1600:master Dec 25, 2018
@Athlon1600
Copy link
Owner

Athlon1600 commented Dec 27, 2018

^ That's basically it.

I made the fix:
a2c1e1c

Check the links from the Demo section. They're working now.

@crsurfer
Copy link

crsurfer commented Mar 3, 2019

hey@Athlon1600
1- thanks for creating this script!
2- I'm trying to run this script but I can't get it to work properly. I get:

Invalid argument supplied for foreach()
foreach ($instructions as $opt) {
line 182

@Athlon1600
Copy link
Owner

^ that was fixed here:
cf7f863

do: composer update to get the latest version

@crsurfer
Copy link

crsurfer commented Mar 3, 2019

thanks @Athlon1600, I don't know much about packages but if I do composer update, it doesn't really update the file. but for testing I did copy the code you had in that reference and worked. now I'm getting the URL, but I can't download any video ( access denied )

also this url : https://api.unblockvideos.com/youtube_downloader?id=4Ai63AkrZDk&selector=mp4&redirect=true has an exception.

@sfatfarma
Copy link

@Athlon1600 I love you, man!

@Athlon1600
Copy link
Owner

Athlon1600 commented Feb 9, 2020

I don't know much about packages but if I do composer update, it doesn't really update the file.

Try removing your composer.lock file and doing composer update then.

also this url : https://api.unblockvideos.com/youtube_downloader?id=4Ai63AkrZDk&selector=mp4&redirect=true has an exception.

That's because that video is private:

https://www.youtube.com/watch?v=4Ai63AkrZDk

image

@pdriss
Copy link

pdriss commented Apr 25, 2020

Thank you very much for your work !
Thanks to you, I have a system that works perfectly!
thanks again

@zxyu1010
Copy link

zxyu1010 commented Sep 26, 2020

Hello my friend, I do not know how to create an application in heroku. Can you send an explanatory video about creating the application?

@Aniketh01
Copy link

How does this project find the manifest file?

@halocedark
Copy link

Thank you for this helpful package, however I can get the video to play inside html tag, but I cannot download the video using anchor tag ""

this is the code I use:

`<?php

include_once '../vendor/autoload.php';

use YouTube\YouTubeDownloader;
use YouTube\Exception\YouTubeException;

$youtube = new YouTubeDownloader();

$output = '';

try {
$links = $youtube->getDownloadLinks("https://www.youtube.com/watch?v=cWvR8zsNeDU&list=PLs2aOcA-EaLMzAOFn8ZFuZyq_It6StOOQ");
$formats = $links->getAllFormats();
if ($formats)
{
$output .= '';
$output .= 'Download';
}
else
{
echo 'No links found';
}

} catch (YouTubeException $e) {
echo 'Something went wrong: ' . $e->getMessage();
}

echo $output;
`

When I click on download link, it simply open up new tab and play the video, but I don't want that, I simply want to trigger the browser to download the video.

Guys can you help me please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants