python-20 / video-downloader

A python application to download videos
GNU General Public License v3.0
10 stars 10 forks source link

Not working with some videos + (KeyError: 'url_encoded_fmt_stream_map') Temporary Fix inside #7

Closed cherylli closed 4 years ago

cherylli commented 4 years ago

FIX: https://github.com/nficano/pytube/pull/537/files/bceb929e143caadd874955fa422f8a58955bafaf

When trying to download/parse/analyze certain videos via pytube, it'll break the execution of the module pytube == 9.5.3 python 3.7.x, & 3.8.x

# To reproduce, create a py file
# copypaste this
from pytube import YouTube

yt = YouTube('https://www.youtube.com/watch?v=dQw4w9WgXcQ')

print(f'Video Title: {yt.title}')

Error output:


 File "c:\project\video-downloader\youtubedl\yt_test.py", line 3, in <module>
    yt = YouTube('https://www.youtube.com/watch?v=dQw4w9WgXcQ')
  File "C:\project\video-downloader\env\lib\site-packages\pytube\__main__.py", line 88, in __init__
    self.prefetch_init()
  File "C:\project\video-downloader\env\lib\site-packages\pytube\__main__.py", line 97, in prefetch_init
    self.init()
  File "C:\project\video-downloader\env\lib\site-packages\pytube\__main__.py", line 143, in init
    mixins.apply_descrambler(self.player_config_args, fmt)
  File "C:\project\video-downloader\env\lib\site-packages\pytube\mixins.py", line 100, in apply_descrambler
    for i in stream_data[key].split(',')
KeyError: 'url_encoded_fmt_stream_map'
chonix commented 4 years ago

should we analyze other potential candidates or we wait for the fix?

chonix commented 4 years ago

This commit fixes it.... https://github.com/nficano/pytube/pull/537/files/bceb929e143caadd874955fa422f8a58955bafaf ... but we have to wait for it to be merged on the code. So I'm guessing we'll have to wait a bit.

RyanSamman commented 4 years ago

This branch of pytube is probably better than the master, if we can we should make it so we use it in the requirements.txt or something

hbmartin commented 4 years ago

@cherylli @chonix @RyanSamman I've created a new, actively maintained, Python3 only pytube fork: https://github.com/hbmartin/pytube3 that addresses this and other pytube issues.

I'd be interested in perhaps working to make this the official GUI frontend for pytube3.

RyanSamman commented 4 years ago

Ironically, we have been discussing about moving over to pytube3 a while ago. It's definitely an option, but obviously we need to make sure it works before we make the switch.

Regarding becoming an official GUI frontend, we still have a few features we would like to implement and polish, but we welcome the publicity and testers.

RyanSamman commented 4 years ago

Since we moved to pytube3, this issue can now be closed @cherylli @chonix

cherylli commented 4 years ago

Switch to pytube3, details in readme.md