youtube_data_api 0.1.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8a6e3d0fdb7667728341ea8d7385c736a70c3441
4
- data.tar.gz: fe3f599a362401cfe7dddeb5f22eef8dc97f3170
3
+ metadata.gz: 283309d21399dba484cc7e58c7f1b19b55d80550
4
+ data.tar.gz: 1ebb949d8ad19841183eb8ca9efc6f799610cc8f
5
5
  SHA512:
6
- metadata.gz: 66d86d1053fe4205d5f5eee0e38096541f3614b3f185d224d8aa5022b021f51d618ed41e28a1103882b09e21ab21832cdf04575bb214812f4cf70967bb30093f
7
- data.tar.gz: 41f9b57dd0d55b4188605c41a6a9e53f72a1be314d23c1a02a7b0d658a2b9bc157ca35e5280ceba62203add54fa07a2fdcdf6024624bf838436c34f14b0b0e09
6
+ metadata.gz: e485afcd3b0d7177dc64a18e20364753c96802420aae27df3ada56a9f0c809b5c55a4eabfdd1c9c9c65c65d51e1dd45c65f751bec90c2e2f1f83f44a55def6bb
7
+ data.tar.gz: 3a44a1327562ef662af658f3500367c84acb11dbea695ab7fb7f1b75df279d2b668a5952cc9c243c0b7d505faa3a4f13f7869c735c5ae7e77ae989efb265b3a1
data/README.md CHANGED
@@ -8,56 +8,89 @@ A ruby library interface to the [YouTube Data API](https://developers.google.com
8
8
  gem install youtube_data_api
9
9
  ````
10
10
 
11
- Or install with bundler
12
- by adding `gem youtube_data_api, '~> 3.0'` to your application's Gemfile
13
- before performing a `bundle install`.
11
+ If using bundler:
12
+ add `gem youtube_data_api, '~> 3.0'` to the Gemfile,
13
+ then run `bundle install`.
14
14
 
15
15
  ## Usage
16
16
 
17
- Parse Youtube data.
17
+ ### API Requests
18
+
19
+ #### Get Channel
18
20
 
19
21
  ```` rb
22
+ channel_url = "https://www.youtube.com/user/CSPAN"
23
+ YoutubeDataApi.channel(channel_url)
24
+ ````
20
25
 
21
- # CHANNELS
26
+ #### List Playlists for a given Channel
22
27
 
28
+ ```` rb
23
29
  channel_url = "https://www.youtube.com/user/CSPAN"
24
- YoutubeDataApi.channel(channel_url)
25
30
  YoutubeDataApi.channel_playlists(channel_url)
31
+ ````
32
+
33
+ #### Get Playlist
26
34
 
27
- # PLAYLISTS
35
+ ```` rb
28
36
 
29
37
  playlist_url = "https://www.youtube.com/playlist?list=PLf0o4wbW8SXqTSo6iJkolKCKJYBnpo9NZ"
30
38
  YoutubeDataApi.playlist(playlist_url)
39
+ ````
40
+
41
+ #### List Playlist Items (Videos)
42
+
43
+ ```` rb
44
+ playlist_url = "https://www.youtube.com/playlist?list=PLf0o4wbW8SXqTSo6iJkolKCKJYBnpo9NZ"
31
45
  YoutubeDataApi.playlist_items(playlist_url)
46
+ ````
32
47
 
33
- # VIDEOS
48
+ #### Get Video
34
49
 
50
+ ```` rb
35
51
  video_url = "https://www.youtube.com/watch?v=oBM7DIeMsP0"
36
52
  YoutubeDataApi.video(video_url)
37
53
  ````
38
54
 
39
- ### Prerequisites
55
+ ### Pagination
56
+
57
+ You may need to paginate through responses.
58
+
59
+ ```` rb
60
+ channel_url = "https://www.youtube.com/user/CSPAN"
61
+ response = YoutubeDataApi.channel_playlists(channel_url)
62
+ while response do
63
+ puts response["pageInfo"]
64
+
65
+ if response["nextPageToken"]
66
+ request_params = {:page_token => response["nextPageToken"]}
67
+ response = YoutubeDataApi.channel_playlists(channel_url, request_params)
68
+ else
69
+ response = nil
70
+ end
71
+ end
72
+ ````
73
+
74
+ ## Prerequisites
40
75
 
41
- #### YouTube-API-enabled Application
76
+ ### YouTube-API-enabled Application
42
77
 
43
78
  Create a new application in the [google developer console](https://console.developers.google.com), and note its name. Navigate to the **APIs & Auth > APIs** menu and enable the *YouTube Data API v3* by searching for it. Refer to the
44
79
  [YouTube API Application Registration Guide](https://developers.google.com/youtube/registering_an_application)
45
80
  for more support.
46
81
 
47
- #### Youtube API Key
82
+ ### Youtube API Key
48
83
 
49
84
  Navigate to the **APIs & Auth > Credentials** menu and add credentials for an API Key, specifically, a **Server Key**. Note the value of your API Key. Refer to the [YouTube API Key Generation Guide](https://developers.google.com/youtube/registering_an_application#Create_API_Keys)
50
85
  for more support.
51
86
 
52
- ### Configuration
87
+ ## Configuration
53
88
 
54
- Configure the library
55
- to make requests on behalf of your YouTube API Key
56
- by
57
- assigning it to an environment variable or
58
- passing it as a request parameter.
89
+ Make requests on behalf of your YouTube API-enabled Application
90
+ by using an environment variable approach or
91
+ a request parameter approach to specifying your API Key.
59
92
 
60
- #### Environment Variable
93
+ ### Environment Variable
61
94
 
62
95
  If using the environment variable configuration approach,
63
96
  add a variable called `YOUTUBE_DATA_API_KEY` to your **.bash_profile**:
@@ -66,7 +99,7 @@ If using the environment variable configuration approach,
66
99
  export YOUTUBE_DATA_API_KEY="my-key-123"
67
100
  ````
68
101
 
69
- #### Request Parameter
102
+ ### Request Parameter
70
103
 
71
104
  If using the request parameter configuration approach, pass the `:api_key` parameter to any request:
72
105
 
@@ -1,3 +1,3 @@
1
1
  module YoutubeDataApi
2
- VERSION = "0.1.0"
2
+ VERSION = "3.0.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: youtube_data_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - MJ Rossetti (@s2t2)