Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
SeoulSKY committed Jul 7, 2024
1 parent 627d7ca commit 6ddc0a1
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 10 deletions.
27 changes: 22 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ This library uses YouTube Data API v3 via
[PubSubHubbub](https://developers.google.com/youtube/v3/guides/push_notifications) to receive push
notifications, so you can receive notifications in real time without constantly polling the YouTube API.

In addition, this method doesn't require any API key, so you can use this library **without any quota limit**.
In addition, this method doesn't require any API key for YouTube Data API, so you can use this library **without any quota limit**.

# 💻 Installation

Expand All @@ -33,15 +33,14 @@ This library requires `Python 3.11` or higher.
pip install ytnoti
```

# 📝 Simple Example
# 📖 Simple Example

For more examples, please visit the [examples](https://github.com/SeoulSKY/ytnoti/tree/main/examples) folder.
Following is a simple example of how to use [ngrok](https://dashboard.ngrok.com/get-started/setup) to receive push notifications.

```python
from ytnoti import YouTubeNotifier, Video
from pyngrok import ngrok
from ytnoti import YouTubeNotifier, Video

# Create your ngrok token free from https://dashboard.ngrok.com/get-started/setup
ngrok.set_auth_token("Your ngrok token here")

notifier = YouTubeNotifier()
Expand All @@ -56,6 +55,24 @@ notifier.subscribe("UC9EEyg7QBL-stRX-7hTV3ng") # Channel ID of SpeedyStyle
notifier.run()
```

Following is a simple example of how to use your domain to receive push notifications.

```python
from ytnoti import YouTubeNotifier, Video

notifier = YouTubeNotifier(callback_url="https://yourdomain.com")


@notifier.upload()
async def listener(video: Video):
print(f"New video from {video.channel.name}: {video.title}")

notifier.subscribe("UC9EEyg7QBL-stRX-7hTV3ng") # Channel ID of SpeedyStyle
notifier.run()
```

For more examples, please visit the [examples](https://github.com/SeoulSKY/ytnoti/tree/main/examples) folder.

# 📚 Documentation

Please read the [documentation](https://ytnoti.readthedocs.io/en/latest/) before asking questions.
Expand Down
30 changes: 25 additions & 5 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ This library uses YouTube Data API v3 via
`PubSubHubbub <https://developers.google.com/youtube/v3/guides/push_notifications>`_ to receive push
notifications, so you can receive notifications in real-time without constantly polling the YouTube API.

In addition, this method doesn't require any API key, so you can use this library **without any quota limit**.
In addition, this method doesn't require any API key for YouTube Data API, so you can use this library **without any quota limit**.

💻 Installation
------------------
Expand All @@ -44,28 +44,48 @@ This library requires `Python 3.11` or higher.
pip install ytnoti
📝 Simple Example
📖 Simple Example
------------------

For more examples, please visit the `examples <https://github.com/SeoulSKY/ytnoti/tree/main/examples>`_ folder.
Following is a simple example of how to use `ngrok <https://dashboard.ngrok.com/get-started/setup>`_ to receive push notifications.

.. code:: python
from ytnoti import YouTubeNotifier, Video
from pyngrok import ngrok
from ytnoti import YouTubeNotifier, Video
# Create your ngrok token free from https://dashboard.ngrok.com/get-started/setup
ngrok.set_auth_token("Your ngrok token here")
notifier = YouTubeNotifier()
@notifier.upload()
async def listener(video: Video):
print(f"New video from {video.channel.name}: {video.title}")
notifier.subscribe("UC9EEyg7QBL-stRX-7hTV3ng") # Channel ID of SpeedyStyle
notifier.run()
Following is a simple example of how to use your domain to receive push notifications.

.. code:: python
from ytnoti import YouTubeNotifier, Video
notifier = YouTubeNotifier(callback_url="https://yourdomain.com")
@notifier.upload()
async def listener(video: Video):
print(f"New video from {video.channel.name}: {video.title}")
notifier.subscribe("UC9EEyg7QBL-stRX-7hTV3ng") # Channel ID of SpeedyStyle
notifier.run()
For more examples, please visit the `examples <https://github.com/SeoulSKY/ytnoti/tree/main/examples>`_ folder.

👥 Community
-------------

Expand Down

0 comments on commit 6ddc0a1

Please sign in to comment.