|
1 | 1 | ytmusicapi: Unofficial API for YouTube Music |
2 | 2 | ############################################ |
3 | 3 |
|
4 | | -.. |pypi-downloads| image:: https://img.shields.io/pypi/dm/ytmusicapi?style=flat-square |
5 | | - :alt: PyPI Downloads |
6 | | - :target: https://pypi.org/project/ytmusicapi/ |
7 | | - |
8 | | -.. |gitter| image:: https://badges.gitter.im/sigma67/ytmusicapi.svg |
9 | | - :alt: Ask questions at https://gitter.im/sigma67/ytmusicapi |
10 | | - :target: https://gitter.im/sigma67/ytmusicapi |
11 | | - |
12 | | -.. |code-coverage| image:: https://img.shields.io/codecov/c/github/sigma67/ytmusicapi?style=flat-square |
13 | | - :alt: Code coverage |
14 | | - :target: https://codecov.io/gh/sigma67/ytmusicapi |
15 | | - |
16 | | -.. |latest-release| image:: https://img.shields.io/github/v/release/sigma67/ytmusicapi?style=flat-square |
17 | | - :alt: Latest release |
18 | | - :target: https://github.com/sigma67/ytmusicapi/releases/latest |
19 | | - |
20 | | -.. |commits-since-latest| image:: https://img.shields.io/github/commits-since/sigma67/ytmusicapi/latest?style=flat-square |
21 | | - :alt: Commits since latest release |
22 | | - :target: https://github.com/sigma67/ytmusicapi/commits |
23 | | - |
24 | | - |
25 | | -|pypi-downloads| |gitter| |code-coverage| |latest-release| |commits-since-latest| |
| 4 | +This is an async prototype of `ytmusicapi <https://github.com/sigma67/ytmusicapi>`_. Use with caution. |
26 | 5 |
|
27 | 6 | ytmusicapi is a Python 3 library to send requests to the YouTube Music API. |
28 | 7 | It emulates YouTube Music web client requests using the user's cookie data for authentication. |
@@ -96,12 +75,15 @@ Usage |
96 | 75 | ------ |
97 | 76 | .. code-block:: python |
98 | 77 |
|
99 | | - from ytmusicapi import YTMusic |
| 78 | + import ytmusicapi |
| 79 | + import asyncio |
| 80 | +
|
| 81 | + async def main(): |
| 82 | + ytm = ytmusicapi.YTMusic() |
| 83 | + results = await ytm.search("coldpaly", filter="songs", limit=1) |
| 84 | + print(results) |
100 | 85 |
|
101 | | - yt = YTMusic('oauth.json') |
102 | | - playlistId = yt.create_playlist('test', 'test description') |
103 | | - search_results = yt.search('Oasis Wonderwall') |
104 | | - yt.add_playlist_items(playlistId, [search_results[0]['videoId']]) |
| 86 | + asyncio.run(main()) |
105 | 87 |
|
106 | 88 | The `tests <https://github.com/sigma67/ytmusicapi/blob/master/tests/>`_ are also a great source of usage examples. |
107 | 89 |
|
|
0 commit comments