Skip to content

Commit

Permalink
Update usage.rst
Browse files Browse the repository at this point in the history
  • Loading branch information
FahimFBA committed Sep 15, 2024
1 parent 4a59ac6 commit 53dea63
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,30 @@ Exceptions

.. autoexception:: ytubeinsight.YTubeInsightError
:members:

Getting a YouTube Data API Key
------------------------------

To use YTubeInsight, you need a YouTube Data API key. Here's how to get one:

1. Go to the `Google Developers Console <https://console.developers.google.com/>`_.
2. Create a new project or select an existing one.
3. Enable the YouTube Data API v3 for your project.
4. Create credentials (API key) for your project.
5. Use this API key in your YTubeInsight calls.

Remember to keep your API key secret and never share it publicly.

Error Handling
--------------

YTubeInsight uses custom exceptions to handle errors. Here's an example of how to handle errors:

.. code-block:: python
from ytubeinsight import analyze_channel, YTubeInsightError
try:
result = analyze_channel('https://www.youtube.com/channel/UC_x5XG1OV2P6uZZ5FSM9Ttw', API_KEY)
except YTubeInsightError as e:
print(f"An error occurred: {str(e)}")

0 comments on commit 53dea63

Please sign in to comment.