gunturbudi / codeshare

Share Some Code
2 stars 4 forks source link

AttributeError: 'YouTube' object has no attribute 'filter' #1

Open manoj444777 opened 6 years ago

manoj444777 commented 6 years ago

I have following issue while using the code. Please help Me Traceback (most recent call last): File "ytdown_bulk.py", line 13, in mp4files = yt.filter('mp4') AttributeError: 'YouTube' object has no attribute 'filter'

(youtube) C:\Users\mallikarjun.reddy>python Python 2.7.8 |Continuum Analytics, Inc.| (default, Jul 2 2014, 15:12:11) [MSC v.1500 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. Anaconda is brought to you by Continuum Analytics. Please check out: http://continuum.io/thanks and https://binstar.org

code in ytdown_bulk.py from pytube import YouTube SAVE_PATH = "C:/Users/mallikarjun.reddy/Downloads/VIDEOS/" links = open('links.txt','r') for l in links: get_true = True while get_true: try: yt = YouTube(l) get_true = False except: print("Connection Error") continue mp4files = yt.filter('mp4') try: print(yt.filename) print(mp4files[-1]) except: pass

video = yt.get(mp4files[-1].extension,mp4files[-1].resolution)
try:
    video.download(SAVE_PATH)
except:
    print("Error, Maybe Duplicate File")
    continue
Temam123 commented 5 years ago

even anaconda can't support any filter object as a module or submodule totally the code might have been changed please any one has an idea

kylefoley76 commented 4 years ago

I'm having this problem too

akshitkishore commented 4 years ago

from pytube import YouTube yt = YouTube("Please copy and paste the video link here") print(yt.title) stream = yt.streams.first() stream.download()

use this code instead

aneeka657 commented 3 years ago

did you get the solution ? I am getting same problem

mp4files = yt.filter('mp4') 'str' object has no attribute 'filter'

Jeno2020 commented 3 years ago

This works for me:

from pytube import YouTube

SAVE_PATH = "d:/path to video file/" link = "https://www.youtube.com/watch?v=xxxxxxxxxxxx"

yt = YouTube(link) stream = yt.streams.first() stream.download(SAVE_PATH)