Reputation: 11
When I try to use this code (in pytube):
import pytube as Youtube
tr = Youtube("https://youtu.be/6MUP0bItFQU")
This error appears to me:
TypeError: 'module' object is not callable
Can someone help me please ?
Upvotes: 1
Views: 338
Reputation: 31379
You're importing the module pytube
and calling it YouTube
, where you really want to from pytube import YouTube
, which is importing YouTube
from the pytube
module.
You get that error because you call YouTube
with Youtube("https://youtu.be/6MUP0bItFQU")
- but since YouTube
is just the renamed pytube
module at that point, you're calling a module (and not a class constructor or some other function).
So:
from pytube import YouTube
tr = YouTube("https://youtu.be/6MUP0bItFQU")
The documentation of PyTube shows the same, and provides some examples of how to continue use.
Upvotes: 3