Title: | R Client for the YouTube Analytics and Reporting API |
Version: | 0.2.1 |
Maintainer: | Gaurav Sood <gsood07@gmail.com> |
Description: | Get statistics and reports from YouTube. To learn more about the YouTube Analytics and Reporting API, see https://developers.google.com/youtube/reporting/. |
URL: | https://github.com/gojiplus/tubern |
BugReports: | https://github.com/gojiplus/tubern/issues |
Depends: | R (≥ 4.1.0) |
License: | MIT + file LICENSE |
Encoding: | UTF-8 |
Imports: | httr, jsonlite |
VignetteBuilder: | knitr |
Suggests: | knitr (≥ 1.11), testthat, rmarkdown, xml2, lintr |
RoxygenNote: | 7.3.2 |
NeedsCompilation: | no |
Packaged: | 2025-03-24 18:03:05 UTC; soodoku |
Author: | Gaurav Sood [aut, cre] |
Repository: | CRAN |
Date/Publication: | 2025-03-24 18:50:02 UTC |
tubern provides access to the YouTube Analytics and Reporting API
Description
Get statistics and reports from YouTube. To learn more about the YouTube Analytics and Reporting API, see https://developers.google.com/youtube/reporting/.
Author(s)
Maintainer: Gaurav Sood gsood07@gmail.com
See Also
Useful links:
Add Group Item
Description
Add Group Item
Usage
add_group_item(resource_details, ...)
Arguments
resource_details |
Named nested list. Required. Must provide: groupId, resource.id |
... |
Additional arguments passed to |
Value
named list
References
https://developers.google.com/youtube/analytics/v1/reference/groupItems/insert
Examples
## Not run:
add_group_item(list(groupId = "", resouce.id ="hello"))
## End(Not run)
Add Groups
Description
Add Groups
Usage
add_groups(resource_details, ...)
Arguments
resource_details |
Named nested list. Required. Must provide: etag, snippet title and contentDetails itemType |
... |
Additional arguments passed to |
Value
named list
References
https://developers.google.com/youtube/analytics/v1/reference/groups/insert
Examples
## Not run:
add_groups(list(etag="vponEBg8hrR1yBUX0Hz66Uc5WMk/vyGp6PvFo4RvsFtPoIWeCReyIC8",
ContentDetails = list(itemType="youtube#channel"), snippet = list(title ="hello")))
## End(Not run)
Delete Group
Description
Delete Group
Usage
delete_group(id, ...)
Arguments
id |
String. Required. “The id parameter specifies the YouTube group ID of the group that is being deleted.” |
... |
Additional arguments passed to |
Value
named list
References
https://developers.google.com/youtube/analytics/v1/reference/groups/delete
Examples
## Not run:
delete_group(id="ABZZzGSIAAA")
## End(Not run)
Delete Group
Description
Delete Group
Usage
delete_group_item(id, ...)
Arguments
id |
String. Required. “The id parameter specifies the YouTube group item ID for the group that is being deleted.” |
... |
Additional arguments passed to |
Value
named list
References
https://developers.google.com/youtube/analytics/v1/reference/groupItems/delete
Examples
## Not run:
delete_group_item(id="ABZZzGSIAAA")
## End(Not run)
Get Reports
Description
Lists reporting jobs that have been scheduled for a channel or content owner.
Usage
get_report(
ids,
metrics,
start_date = NULL,
end_date = NULL,
currency = NULL,
dimensions,
filters,
historical_channel_data = NULL,
max_results = NULL,
sort = NULL,
start_index = NULL,
user_ip = NULL,
...
)
Arguments
ids |
Named vector with two potential names: channel or contentOwner If channel, potential values are: mine or channel_id If contentOwner, potential values are: owner_id of the content |
metrics |
String. Comma-separated list of YouTube Analytics metrics, such as |
start_date |
String. Must be in YYYY-MM-DD format. |
end_date |
String. Must be in YYYY-MM-DD format. |
currency |
Optional. String. Default is USD. Specifies what earnings metrics like
|
dimensions |
String. Optional. Comma-separated list of YouTube Analytics dimensions, such as |
filters |
Named Vector. Optional. For instance, “ |
historical_channel_data |
Boolean. Defaults is False. “Whether the API response should include channels' watch time and view data from the time period prior to when the channels were linked to the content owner.” |
max_results |
Integer. Optional. The maximum number of rows to include in the response. |
sort |
String. Optional A comma-separated list of dimensions or metrics that determine the sort order for YouTube |
start_index |
Integer. Optional. “The 1-based index of the first entity to retrieve.” |
user_ip |
“IP address of the end user for whom the API call is being made.” |
... |
Additional arguments passed to |
Value
named list
References
https://developers.google.com/youtube/analytics/v1/reference/reports/query
Examples
## Not run:
get_report(ids = "channel==MINE", metrics = "views",
start_date = "2010-04-01", end_date ="2017-01-01")
## End(Not run)
List Group Items
Description
List Group Items
Usage
list_group_items(group_id, ...)
Arguments
group_id |
String. Required. ID of the group |
... |
Additional arguments passed to |
Value
named list
References
https://developers.google.com/youtube/analytics/v1/reference/groupItems/list
Examples
## Not run:
list_group_items(group_id = "vponEBg8hrR1yBUX0Hz66Uc5WMk/vyGp6PvFo4RvsFtPoIWeCReyIC8")
## End(Not run)
List Groups
Description
List Groups
Usage
list_groups(filter, page_token, ...)
Arguments
filter |
Named Vector. Required. Only One of the two: id or mine. id “The Named parameter specifies a comma-separated list of the YouTube group ID(s) for the resource(s) that are being retrieved.” mine String. Can be 'True' or 'False.' “Set this parameter's value to true to retrieve all groups owned by the authenticated user.” |
page_token |
String. Optional. “Identifies a specific page in the result set that should be returned.” |
... |
Additional arguments passed to |
Value
named list
References
https://developers.google.com/youtube/analytics/v1/reference/groups/list
Examples
## Not run:
list_groups(filter = c(mine = 'True'))
## End(Not run)
DELETE
Description
DELETE
Usage
tubern_DELETE(path, query = NULL, body = "", ...)
Arguments
path |
path to specific API request URL |
query |
query list |
body |
passing image through body |
... |
Additional arguments passed to |
Value
list
Base POST AND GET functions. Not exported.
Description
GET
Usage
tubern_GET(path, query = NULL, ...)
Arguments
path |
path to specific API request URL |
query |
query list |
... |
Additional arguments passed to |
Value
list
POST
Description
POST
Usage
tubern_POST(path, query = NULL, body = "", ...)
Arguments
path |
path to specific API request URL |
query |
query list |
body |
passing image through body |
... |
Additional arguments passed to |
Value
list
PUT
Description
PUT
Usage
tubern_PUT(path, query = NULL, body = "", ...)
Arguments
path |
path to specific API request URL |
query |
query list |
body |
passing image through body |
... |
Additional arguments passed to |
Value
list
Update Groups
Description
Update Groups
Usage
update_group(resource_details, ...)
Arguments
resource_details |
Named nested list. Required. Must provide: id, snippet title |
... |
Additional arguments passed to |
Value
named list
References
https://developers.google.com/youtube/analytics/v1/reference/groups/update
Examples
## Not run:
update_group(list(id="ABZZzGSIAAA", snippet = list(title ="hello")))
## End(Not run)
Check if authentication token is in options
Description
Check if authentication token is in options
Usage
yt_check_token()
Set up Authorization
Description
The function looks for .httr-oauth in the working directory. If it doesn't find it, it expects an application ID and a secret. If you want to remove the existing .httr-oauth, set remove_old_oauth to TRUE. By default, it is set to FALSE. The function launches a browser to allow you to authorize the application
Usage
yt_oauth(
app_id = NULL,
app_secret = NULL,
scope = "analytics",
token = ".httr-oauth",
...
)
Arguments
app_id |
client id; required; no default |
app_secret |
client secret; required; no default |
scope |
Character. |
token |
path to file containing the token. If a path is given, the function will first try to read from it. Default is |
... |
Additional arguments passed to |
Value
sets the google_token option and also saves .httr_auth in the working directory (find out the working directory via getwd())
References
https://developers.google.com/youtube/analytics/v1/reference/
https://developers.google.com/youtube/analytics/v1/reference/ for different scopes
Examples
## Not run:
yt_oauth("998136489867-5t3tq1g7hbovoj46dreqd6k5kd35ctjn.apps.googleusercontent.com",
"MbOSt6cQhhFkwETXKur-L9rN")
## End(Not run)