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

Demo example broken (KeyError: 'url_encoded_fmt_stream_map') #552

Closed
jangroth opened this issue Jan 15, 2020 · 7 comments
Closed

Demo example broken (KeyError: 'url_encoded_fmt_stream_map') #552

jangroth opened this issue Jan 15, 2020 · 7 comments

Comments

@jangroth
Copy link

jangroth commented Jan 15, 2020

I've noticed this error since yesterday (used to work, failed from one minute to the next).

I'm new to pytube, but I believe this is related to issue #467 which also shows some recent activity.

Feel free to mark this as a duplicate, just wanted to create a new issue to point out that the actual demo from the 101 documentation stopped working.

>>> from pytube import YouTube
>>> YouTube('https://youtu.be/9bZkp7q19f0').streams.first().download()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/jan/.local/share/virtualenvs/pycast-pLleJR-U/lib/python3.7/site-packages/pytube/__main__.py", line 88, in __init__
    self.prefetch_init()
  File "/Users/jan/.local/share/virtualenvs/pycast-pLleJR-U/lib/python3.7/site-packages/pytube/__main__.py", line 97, in prefetch_init
    self.init()
  File "/Users/jan/.local/share/virtualenvs/pycast-pLleJR-U/lib/python3.7/site-packages/pytube/__main__.py", line 143, in init
    mixins.apply_descrambler(self.player_config_args, fmt)
  File "/Users/jan/.local/share/virtualenvs/pycast-pLleJR-U/lib/python3.7/site-packages/pytube/mixins.py", line 96, in apply_descrambler
    for i in stream_data[key].split(',')
KeyError: 'url_encoded_fmt_stream_map'

UPDATE: The pytube project appears unmaintained at the moment. See here.

  • If you are looking to fix the problem mentioned in this issue and are happy to patch source code, follow the advice given in KeyError: 'url_encoded_fmt_stream_map' #467 .
  • If this is not acceptable, pytube might not be right for you. pytube3 (see below) could be an option.
@movraxrsp
Copy link

I have applied the diffs in pull request #467.

Works fine for me:

Python 3.8.1 (tags/v3.8.1:1b293b6, Dec 18 2019, 22:39:24) [MSC v.1916 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from pytube import YouTube
>>> YouTube('https://youtu.be/9bZkp7q19f0').streams.first().download()
'C:\\Users\\u\\dl\\PSY - GANGNAM STYLE(강남스타일) MV.mp4'
>>> 

Apply the diffs from swiftyy-mage's pull request . It should work. Let me know. I'll help.

@bigsandip
Copy link

I have applied the diffs in pull request #467.

Works fine for me:

Python 3.8.1 (tags/v3.8.1:1b293b6, Dec 18 2019, 22:39:24) [MSC v.1916 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from pytube import YouTube
>>> YouTube('https://youtu.be/9bZkp7q19f0').streams.first().download()
'C:\\Users\\u\\dl\\PSY - GANGNAM STYLE(강남스타일) MV.mp4'
>>> 

Apply the diffs from swiftyy-mage's pull request . It should work. Let me know. I'll help.

Thank you.Its working now

@hbmartin
Copy link
Contributor

@jangroth @bigsandip fixed in my Python 3 only fork: https://github.com/hbmartin/pytube3

@jangroth
Copy link
Author

@jangroth @bigsandip fixed in my Python 3 only fork: https://github.com/hbmartin/pytube3

[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]

[packages]
boto3 = "*"
requests = "*"
pytube3 = "*"

[requires]
python_version = "3.7"

I've now switched to pytube3. Works like a charm.

@Shaked-Aharon
Copy link

try using pytube3 that lib as been updated and look to work fine

@sokol8
Copy link

sokol8 commented Feb 15, 2020

had same issue with pytube.
pytube3 completely solved the issue

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

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

No branches or pull requests

6 participants