question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] Failure to parse transform_plan due to key of "do" which is a keyword

See original GitHub issue

Before creating an issue Yes I have updated to the latest version

Describe the bug Errors at var, _ = self.transform_plan[0].split(".") due to transform_plan looking like this:

['Mx["do"](a,17)', 'Mx.FH(a,61)', 'Mx.xK(a,3)', 'Mx["do"](a,12)', 'Mx.xK(a,1)', 'Mx.FH(a,37)', 'Mx["do"](a,47)', 'Mx.FH(a,6)']

Attempted the most naive fix I could think of:

self.transform_plan: List[str] = [x.replace("[\"", ".").replace("\"]", "") for x in get_transform_plan(js)]

results in

File "/home/lachie/anaconda3/envs/spotdl/lib/python3.9/site-packages/pytube/cipher.py", line 55, in get_signature
    signature = self.transform_map[name](signature, argument)
KeyError: 'do'

Which is no surprise at all and I didn’t expect it to work.

To Reproduce Please provide the following information:

  • The video or playlist url that is causing the error.
    • Every url I have tried so far gives this error because the transform plan is always the same.
  • The code where the problem is occurring.
    • see above, but it’s in cypher.py in Cypher.__init__

Expected behavior This is an unhandled edge case, so I expect it to fail every time

Output

(spotdl) xxx@yyy:~$ spotdl https://open.spotify.com/track/5JWPUEov2wlX7c0jhYZpeB?si=wm_lePrPQdWoPoknBas1RA
Fetching Song...
Searching for: Tame Impala - Lost In Yesterday
  0%|                                                                               |ETA: ?, ~min/songTraceback (most recent call last):
  File "/home/xxx/anaconda3/envs/spotdl/bin/spotdl", line 8, in <module>
    sys.exit(console_entry_point())
  File "/home/xxx/anaconda3/envs/spotdl/lib/python3.9/site-packages/spotdl/__main__.py", line 99, in console_entry_point
    downloader.download_single_song(song)
  File "/home/xxx/anaconda3/envs/spotdl/lib/python3.9/site-packages/spotdl/download/downloader.py", line 69, in download_single_song
    self._download_asynchronously([songObj])
  File "/home/xxx/anaconda3/envs/spotdl/lib/python3.9/site-packages/spotdl/download/downloader.py", line 351, in _download_asynchronously
    self.loop.run_until_complete(asyncio.gather(*tasks))
  File "/home/xxx/anaconda3/envs/spotdl/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/home/xxx/anaconda3/envs/spotdl/lib/python3.9/site-packages/spotdl/download/downloader.py", line 346, in _pool_download
    return await self.download_song(song_obj)
  File "/home/xxx/anaconda3/envs/spotdl/lib/python3.9/site-packages/spotdl/download/downloader.py", line 167, in download_song
    youtubeHandler = YouTube(
  File "/home/xxx/anaconda3/envs/spotdl/lib/python3.9/site-packages/pytube/__main__.py", line 105, in __init__
    self.descramble()
  File "/home/xxx/anaconda3/envs/spotdl/lib/python3.9/site-packages/pytube/__main__.py", line 177, in descramble
    apply_signature(self.player_config_args, fmt, self.js)
  File "/home/xxx/anaconda3/envs/spotdl/lib/python3.9/site-packages/pytube/extract.py", line 370, in apply_signature
    cipher = Cipher(js=js)
  File "/home/xxx/anaconda3/envs/spotdl/lib/python3.9/site-packages/pytube/cipher.py", line 36, in __init__
    var, _ = self.transform_plan[0].split(".")
ValueError: not enough values to unpack (expected 2, got 1)
Exception ignored in: <function tqdm.__del__ at 0x7f6c87f0ed30>
Traceback (most recent call last):
  File "/home/xxx/anaconda3/envs/spotdl/lib/python3.9/site-packages/tqdm/std.py", line 1138, in __del__
  File "/home/xxx/anaconda3/envs/spotdl/lib/python3.9/site-packages/tqdm/std.py", line 1285, in close
  File "/home/xxx/anaconda3/envs/spotdl/lib/python3.9/site-packages/tqdm/std.py", line 1478, in display
  File "/home/xxx/anaconda3/envs/spotdl/lib/python3.9/site-packages/tqdm/std.py", line 1141, in __str__
  File "/home/xxx/anaconda3/envs/spotdl/lib/python3.9/site-packages/spotdl/download/progressHandlers.py", line 22, in format_dict
  File "/home/xxx/anaconda3/envs/spotdl/lib/python3.9/site-packages/tqdm/std.py", line 1436, in format_dict
TypeError: cannot unpack non-iterable NoneType object

System information Please provide the following information:

  • Python version (run python --version)
    • 3.9.1
  • Pytube version (run print(pytube.__version__) in python)
    • 10.5.0
  • Command used to install pytube
    • python -m pip install git+https://github.com/nficano/pytube

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
lost-RDcommented, Feb 23, 2021

Thanks!

0reactions
lost-RDcommented, Feb 23, 2021

Thanks again, works perfectly

Read more comments on GitHub >

github_iconTop Results From Across the Web

Julia | PDF | Integer (Computer Science) | Data Type - Scribd
non-ASCII text, it will gracefully fail with a clear error message, ... In any indexing expression, the keyword end can be used as...
Read more >
m~mmmmmmmmmm -!J - DTIC
This thesis investigates the problem of controlling or directing the reasoning and actions of a computer program.
Read more >
Spread Spectrum Communication without any Pre-shared ...
Abstract. Spread spectrum (SS) communication relies on the assumption that some secret is shared before- hand among communicating nodes in ...
Read more >
IBM Tivoli Storage Productivity Center: User's Guide
Learn about the key tasks for setting up Tivoli Storage Productivity Center for ... v Customize views of performance so that you can...
Read more >
Applying Inductive Program Synthesis to Learning Domain ...
can be applied to learning domain-dependent control knowledge from plan-. ning experience. We represent control rules as recursive program schemes. (RPSs).
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found