Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// ==UserScript==
// @name niconico myvideo search
// @namespace http://web.zgo.jp/
// @description 投稿動画から作者のMyvideoを探す
// @include http://www.nicovideo.jp/watch/*
// ==/UserScript==
(function(){
const videoId = unsafeWindow.Video.id;
var h1 = document.getElementsByTagName('h1')[0];
if(!h1) return;
GM_xmlhttpRequest({
method: 'GET',
url: 'http://www.nicovideo.jp/ranking_graph/mylist/daily/all/' + videoId,
headers: { "User-Agent": "Mozilla/5.0" },
onload: function(res) {
if(res.status==200){
var userVideoId = res.responseText.match(/\bmyvideo\/([0-9]+)/);
//window.gm_nicoUserId = userVideoId[1];
var span = document.createElement('span');
span.style.cssText = 'font-size:small; margin-top:4px; line-height:1.25;';
span.innerHTML = ' <a href="http://www.nicovideo.jp/myvideo/' + userVideoId[1] + '">公開投稿動画</a>';
h1.insertBefore(span, h1.nextChild); // insert position
}else{
GM_log(res.status + ':' + res.statusText);
}
},
onerror: function(res){ GM_log(res.status + ':' + res.statusText); }
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.