Skip to content

Instantly share code, notes, and snippets.

@timfreund
Created May 6, 2019 18:25
Show Gist options
  • Save timfreund/2445193c0c2db651afa5586ade293df4 to your computer and use it in GitHub Desktop.
Save timfreund/2445193c0c2db651afa5586ade293df4 to your computer and use it in GitHub Desktop.
Capture youtube views
function reportview(){
var length = $('.ytp-progress-bar')[0].getAttribute('aria-valuemax');
var title = $('h1.title')[0].innerText;
var payload = {};
payload['length'] = length;
payload['title'] = title;
jQuery.get("http://localhost:8000/youtube", payload);
}
setTimeout(reportview, 10000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment