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

Standalone script for decrypt cipher signature ? #24744

Closed
MegaCron opened this issue Apr 12, 2020 · 2 comments
Closed

Standalone script for decrypt cipher signature ? #24744

MegaCron opened this issue Apr 12, 2020 · 2 comments
Labels

Comments

@MegaCron
Copy link

@MegaCron MegaCron commented Apr 12, 2020

Checklist

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

Question

Hi all.

I do not know how to create scripts in python, I create scripts in bash, but I did not find a solution for decrypting cipher signatures in bash. Youtube-dl has integrated signature decryption, is it possible to export it to a standalone script ?

./decrypt.py "here-encrypted-cipher-signature"

@MegaCron MegaCron added the question label Apr 12, 2020
@dstftw
Copy link
Collaborator

@dstftw dstftw commented Apr 12, 2020

def _decrypt_signature(self, s, video_id, player_url, age_gate=False):
"""Turn the encrypted s field into a working signature"""
if player_url is None:
raise ExtractorError('Cannot decrypt signature without player_url')
if player_url.startswith('//'):
player_url = 'https:' + player_url
elif not re.match(r'https?://', player_url):
player_url = compat_urlparse.urljoin(
'https://www.youtube.com', player_url)
try:
player_id = (player_url, self._signature_cache_id(s))
if player_id not in self._player_cache:
func = self._extract_signature_function(
video_id, player_url, s
)
self._player_cache[player_id] = func
func = self._player_cache[player_id]
if self._downloader.params.get('youtube_print_sig_code'):
self._print_sig_code(func, s)
return func(s)
except Exception as e:
tb = traceback.format_exc()
raise ExtractorError(
'Signature extraction failed: ' + tb, cause=e)

@dstftw dstftw closed this Apr 12, 2020
@MegaCron
Copy link
Author

@MegaCron MegaCron commented Apr 17, 2020

dstftw, Is this a "plug-n-play" stand-alone script or raw code ? I do not understand python code.

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
2 participants
You can’t perform that action at this time.