Skip to content

Instantly share code, notes, and snippets.

@keisei1092
Created January 22, 2017 07:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save keisei1092/49f15f60edbdc76b1d7b246068a54cd1 to your computer and use it in GitHub Desktop.
Save keisei1092/49f15f60edbdc76b1d7b246068a54cd1 to your computer and use it in GitHub Desktop.
var target = $('.yt-lockup-meta-info');
// top
$.each(target, function() {
var videoId = $(this).closest('.yt-lockup').data('context-item-id');
var element = '<li><a href="http://localhost:4568/youtube-dl/' + videoId + '" target="_blank">mp3</a>';
$(this).append(element);
});
// show
if ($('#watch8-secondary-actions') != undefined) {
var videoId = $('.yt-uix-videoactionmenu').data('video-id');
$('#watch8-secondary-actions').append('<div class="yt-uix-menu"><a href="http://localhost:4568/youtube-dl/' + videoId + '" target="_blank">mp3</a></div>');
}
// show=>related
$.each($('.stat.view-count'), function() {
var videoId = $(this).closest('a').attr('href').substring(9, 100);
$(this).closest('a').append('<span class="stat"><a href="http://localhost:4568/youtube-dl/' + videoId + '" target="_blank">mp3</a></span>');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment