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

cell 2 #2

Open
valentin0bhfr opened this issue Jun 8, 2023 · 1 comment
Open

cell 2 #2

valentin0bhfr opened this issue Jun 8, 2023 · 1 comment

Comments

@valentin0bhfr
Copy link

name 'googleapiclient' is not defined

NameError Traceback (most recent call last)
Cell In[3], line 59
56 print(transcripts)
57 write_to_file(transcripts)
---> 59 main(api_key, channel_id)

Cell In[3], line 54, in main(api_key, channel_id)
53 def main(api_key, channel_id):
---> 54 video_ids = get_channel_videos(channel_id, api_key)[:20]
55 transcripts = get_transcripts(video_ids)
56 print(transcripts)

Cell In[3], line 10, in get_channel_videos(channel_id, api_key)
9 def get_channel_videos(channel_id, api_key):
---> 10 youtube = googleapiclient.discovery.build(
11 "youtube", "v3", developerKey=api_key)
15 video_ids = []
16 page_token = None

NameError: name 'googleapiclient' is not defined

I als think YouTubeTranscriptApi in the def get_transcripts(video_ids): is not defined.

I used the YouTube Data API is that correct? you should make clear which API key to use in that cell

All the best!

@dilzilla
Copy link

dilzilla commented Jun 8, 2023

From chatgpt: The error message you're encountering suggests that the module googleapiclient has not been imported or is not accessible in your code. The googleapiclient module is part of the Google API Client Library, which provides the necessary tools for interacting with various Google APIs, including the YouTube Data API.

To resolve this issue, make sure you have installed the required libraries and imported the necessary modules correctly. Here's an example of how you can import the googleapiclient module:

from googleapiclient import discovery

Ensure that you have installed the google-api-python-client library, which includes the googleapiclient module. You can install it using the following command:

pip install google-api-python-client

Make sure to include this import statement at the beginning of your code, before using any functions or classes from the googleapiclient module.

If you have already imported the googleapiclient module and are still encountering this error, double-check that the library is correctly installed and accessible in your current environment.

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

No branches or pull requests

2 participants