Title: | R Client for 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/>. |
Authors: | Gaurav Sood [aut, cre] |
Maintainer: | Gaurav Sood <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.2.0 |
Built: | 2024-11-18 04:54:18 UTC |
Source: | https://github.com/gojiplus/tubern |
Add Group Item
add_group_item(resource_details, ...)
add_group_item(resource_details, ...)
resource_details |
Named nested list. Required. Must provide: groupId, resource.id |
... |
Additional arguments passed to |
named list
https://developers.google.com/youtube/analytics/v1/reference/groupItems/insert
## Not run: add_group_item(list(groupId = "", resouce.id ="hello")) ## End(Not run)
## Not run: add_group_item(list(groupId = "", resouce.id ="hello")) ## End(Not run)
Add Groups
add_groups(resource_details, ...)
add_groups(resource_details, ...)
resource_details |
Named nested list. Required. Must provide: etag, snippet title and contentDetails itemType |
... |
Additional arguments passed to |
named list
https://developers.google.com/youtube/analytics/v1/reference/groups/insert
## Not run: add_groups(list(etag="vponEBg8hrR1yBUX0Hz66Uc5WMk/vyGp6PvFo4RvsFtPoIWeCReyIC8", ContentDetails = list(itemType="youtube#channel"), snippet = list(title ="hello"))) ## End(Not run)
## Not run: add_groups(list(etag="vponEBg8hrR1yBUX0Hz66Uc5WMk/vyGp6PvFo4RvsFtPoIWeCReyIC8", ContentDetails = list(itemType="youtube#channel"), snippet = list(title ="hello"))) ## End(Not run)
Delete Group
delete_group(id, ...)
delete_group(id, ...)
id |
String. Required. “The id parameter specifies the YouTube group ID of the group that is being deleted.” |
... |
Additional arguments passed to |
named list
https://developers.google.com/youtube/analytics/v1/reference/groups/delete
## Not run: delete_group(id="ABZZzGSIAAA") ## End(Not run)
## Not run: delete_group(id="ABZZzGSIAAA") ## End(Not run)
Delete Group
delete_group_item(id, ...)
delete_group_item(id, ...)
id |
String. Required. “The id parameter specifies the YouTube group item ID for the group that is being deleted.” |
... |
Additional arguments passed to |
named list
https://developers.google.com/youtube/analytics/v1/reference/groupItems/delete
## Not run: delete_group_item(id="ABZZzGSIAAA") ## End(Not run)
## Not run: delete_group_item(id="ABZZzGSIAAA") ## End(Not run)
Lists reporting jobs that have been scheduled for a channel or content owner.
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, ...)
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, ...)
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 |
named list
https://developers.google.com/youtube/analytics/v1/reference/reports/query
## Not run: get_report(ids = "channel==MINE", metrics = "views", start_date = "2010-04-01", end_date ="2017-01-01") ## End(Not run)
## 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
list_group_items(group_id, ...)
list_group_items(group_id, ...)
group_id |
String. Required. ID of the group |
... |
Additional arguments passed to |
named list
https://developers.google.com/youtube/analytics/v1/reference/groupItems/list
## Not run: list_group_items(group_id = "vponEBg8hrR1yBUX0Hz66Uc5WMk/vyGp6PvFo4RvsFtPoIWeCReyIC8") ## End(Not run)
## Not run: list_group_items(group_id = "vponEBg8hrR1yBUX0Hz66Uc5WMk/vyGp6PvFo4RvsFtPoIWeCReyIC8") ## End(Not run)
List Groups
list_groups(filter, page_token, ...)
list_groups(filter, page_token, ...)
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 |
named list
https://developers.google.com/youtube/analytics/v1/reference/groups/list
## Not run: list_groups(filter = c(mine = 'True')) ## End(Not run)
## Not run: list_groups(filter = c(mine = 'True')) ## End(Not run)
tubern provides access to the YouTube Analytics and Reporting API
GET
tubern_GET(path, query = NULL, ...)
tubern_GET(path, query = NULL, ...)
path |
path to specific API request URL |
query |
query list |
... |
Additional arguments passed to |
list
Update Groups
update_group(resource_details, ...)
update_group(resource_details, ...)
resource_details |
Named nested list. Required. Must provide: id, snippet title |
... |
Additional arguments passed to |
named list
https://developers.google.com/youtube/analytics/v1/reference/groups/update
## Not run: update_group(list(id="ABZZzGSIAAA", snippet = list(title ="hello"))) ## End(Not run)
## Not run: update_group(list(id="ABZZzGSIAAA", snippet = list(title ="hello"))) ## End(Not run)
Check if authentication token is in options
yt_check_token()
yt_check_token()
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
yt_oauth(app_id = NULL, app_secret = NULL, scope = "analytics", token = ".httr-oauth", ...)
yt_oauth(app_id = NULL, app_secret = NULL, scope = "analytics", token = ".httr-oauth", ...)
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 |
sets the google_token option and also saves .httr_auth in the working directory (find out the working directory via getwd())
https://developers.google.com/youtube/analytics/v1/reference/
https://developers.google.com/youtube/analytics/v1/reference/ for different scopes
## Not run: yt_oauth("998136489867-5t3tq1g7hbovoj46dreqd6k5kd35ctjn.apps.googleusercontent.com", "MbOSt6cQhhFkwETXKur-L9rN") ## End(Not run)
## Not run: yt_oauth("998136489867-5t3tq1g7hbovoj46dreqd6k5kd35ctjn.apps.googleusercontent.com", "MbOSt6cQhhFkwETXKur-L9rN") ## End(Not run)