Skip to content

Commit 91e0453

Browse files
authored
Merge pull request #140 from MerleLiuKun/feat-client
Feat client
2 parents 78d608f + 2de041e commit 91e0453

16 files changed

+969
-18
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## Version 0.9.0 (in development)
6+
7+
### What's New
8+
9+
- Introduce new `Client` to operate YouTube DATA API. [#120](https://github.com/sns-sdks/python-youtube/issues/120).
10+
511
## Version 0.8.3 (2022-10-17)
612

713
### What's New

docs/docs/authorization.md

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ Now we can begin do the follows step.
3030
Initialize the api instance with you app credentials
3131

3232
```
33-
In [1]: from pyyoutube import Api
33+
In [1]: from pyyoutube import Client
3434
35-
In [2]: api = Api(client_id="you client id", client_secret="you client secret")
35+
In [2]: cli = Client(client_id="you client id", client_secret="you client secret")
3636
37-
In [3]: api.get_authorization_url()
37+
In [3]: cli.get_authorize_url()
3838
Out[3]:
3939
('https://accounts.google.com/o/oauth2/v2/auth?response_type=code&client_id=client_id&redirect_uri=https%3A%2F%2Flocalhost%2F&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fyoutube+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile&state=PyYouTube&access_type=offline&prompt=select_account',
4040
'PyYouTube')
@@ -72,7 +72,7 @@ Then you will get a Connection Error, don't worry. This just because we set the
7272
Now you need to copy the full url in the browser address bar. Then back to you console.
7373

7474
```
75-
In [4]: token = api.generate_access_token(authorization_response="the whole url")
75+
In [4]: token = cli.generate_access_token(authorization_response="the whole url")
7676
7777
In [5]: token
7878
Out[5]: AccessToken(access_token='access token', expires_in=3600, token_type='Bearer')
@@ -87,23 +87,14 @@ now you have got your access token to visit your self data.
8787
For example, you can get your playlists.
8888

8989
```
90-
In [6]: playlists = api.get_playlists(mine=True)
90+
In [6]: playlists = cli.playlists.list(mine=True)
9191
9292
In [7]: playlists.items
9393
Out[7]:
9494
[Playlist(kind='youtube#playlist', id='PLBaidt0ilCManGDIKr8UVBFZwN_UvMKvS'),
9595
Playlist(kind='youtube#playlist', id='PLBaidt0ilCMbUdj0EppB710c_X5OuCP2g')]
9696
```
9797

98-
get your self profile.
99-
100-
```
101-
In [8]: profile = api.get_profile()
102-
103-
In [9]: profile
104-
Out[9]: UserProfile(id='110109920178558006671', name='ikaros-life')
105-
```
106-
10798
!!! note "Tips"
10899

109-
If you have some confuse. you need to read the [Authorize Requests](https://developers.google.com/youtube/v3/guides/authentication) first.
100+
If you have some confuse. you need to read the [Authorize Requests](https://developers.google.com/youtube/v3/guides/authentication) first.

docs/docs/getting_started.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,10 @@ Now you have generated one api key.
5454

5555
Use this key. You can retrieve public data for YouTube data by our library
5656

57-
```pythonregexp
58-
In [1]: import pyyoutube
59-
In [2]: api = pyyoutube.Api(api_key='your api key')
57+
```python
58+
from pyyoutube import Client
59+
60+
cli = Client(api_key="your api key")
6061
```
6162

6263
If you want to get some examples to see, check out the [examples](https://github.com/sns-sdks/python-youtube/tree/master/examples).

0 commit comments

Comments
 (0)