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

Get decrypted signature from python script #21499

Closed
Elite opened this issue Jun 23, 2019 · 5 comments
Closed

Get decrypted signature from python script #21499

Elite opened this issue Jun 23, 2019 · 5 comments
Labels

Comments

@Elite
Copy link

@Elite Elite commented Jun 23, 2019

  • [X ] I'm asking a question
  • [X ] I've looked through the README and FAQ for similar questions
  • [X ] I've searched the bugtracker for similar questions including closed ones

Question

I am currently using pytube to get decipher signature from my project as below:

from pytube import cipher
html="base.js CONTENT HERE" 
unsig= 'ALgxI2wwRgIhAN3cG9UXPZSyZcwx2fTOFvbKT_5CAb475HUHuTjSjOw-AiEAjaY1JtcKuHMQkHyCt5cKGBqazj7mpR4EQ1nwGYvhkEc=' 
signature = cipher.get_signature(html, unsig)
print signature

But that project is not updated regularly and would like to use youtube-dl for same. Is this possible, if yes pls. provide pointers for same.

@Elite Elite added the question label Jun 23, 2019
@dstftw
Copy link
Collaborator

@dstftw dstftw commented Jun 23, 2019

signature = self._decrypt_signature(
encrypted_sig, video_id, player_url, age_gate)

@dstftw dstftw closed this Jun 23, 2019
@Elite
Copy link
Author

@Elite Elite commented Jun 24, 2019

Sorry for the noob query but I tried a lot but was not able to figure out a way to import this function my script :(

@Elite
Copy link
Author

@Elite Elite commented Jun 24, 2019

Asked for help at stack and from the reply it seems it cant be done with current ytdl exposed methods !! Pls. check - https://stackoverflow.com/questions/56734345/correct-way-to-call-function-from-imported-python-package/56734930#56734930

@silverbacknet
Copy link

@silverbacknet silverbacknet commented Jun 24, 2019

You were trying to call it static. Don't do that, it won't work. Initialize a new instance and then call _decrypt_signature(), it's not hard at all.

@Elite
Copy link
Author

@Elite Elite commented Jun 27, 2019

Isn't this the correct usage?

from youtube_dl.extractor.youtube import YoutubeIE

import youtube_dl.extractor.youtube as yt
help(yt)

yt=YoutubeIE()

video_id = 'HRfNqYoO9EU'
player_url="https://www.youtube.com/yts/jsbin/player_ias-vfl49f_g4/en_US/base.js" 
unsig= 'ALgxI2wwRgIhAN3cG9UXPZSyZcwx2fTOFvbKT_5CAb475HUHuTjSjOw-AiEAjaY1JtcKuHMQkHyCt5cKGBqazj7mpR4EQ1nwGYvhkEc=' 

signature = yt._decrypt_signature(unsig, video_id, player_url)
print(signature)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.