Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filtering Video Stats #1

Open
rkverma1974 opened this issue Jan 9, 2018 · 1 comment
Open

Filtering Video Stats #1

rkverma1974 opened this issue Jan 9, 2018 · 1 comment

Comments

@rkverma1974
Copy link

Hi - can you please confirm that filters can be used to narrow metrics to specific video IDs (e.g. "video==xxxx"). See below - if I run this code, the variable (tubern_stats) returns the same values as the channel. It doesn't filter on a specific video or set of videos. Can you confirm the syntax? Or should I try something different? Thanks in advance

############################R CODE######################

require(tubern)
httr::set_config( config( ssl_verifypeer = 0L ) ) # = Fixes some certificate problems on linux = #

Authentication

yt_oauth("XXX",
"XXX",token = "")

GET STATS VIA TUBERN

tubern_stats <- (get_report(ids = "channel==MINE", metrics = "views,likes,comments,shares", filters = "video==WfFAup0qXrU,4qtXtBc6Akc;country==US",
start_date = "2010-04-01", end_date ="2017-01-01"))

dfx <- data.frame(NULL)

BEGIN DATA FRAME

metrics <- sapply(seq_along(tubern_stats$columnHeaders), function(i){
unlist(tubern_stats$columnHeaders[[i]]$name)
})

data <- as.vector(sapply(seq_along(tubern_stats$rows), function(i){
unlist(tubern_stats$rows[[i]])
}))

youtube.df <- data.frame(metrics, data)
youtube.df$video_id <- "WfFAup0qXrU"

END DATA #FRAME

@soodoku
Copy link
Member

soodoku commented Jan 10, 2018

what you are doing seems to be fine. they have some sample python code that i cross-checked with so things seem to pan out: https://developers.google.com/youtube/reporting/v1/code_samples/python#retrieve_top_10_videos_by_viewcount

as to why it isn't working, not clear to me.

I am assuming you the channel on which the video is posted:
https://www.youtube.com/watch?v=WfFAup0qXrU

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants