2015年11月20日金曜日

Youku の API

Youku の API

Player API です。 YouTube IFrame APIと似ってます。
client_id の項目はYoutube にはない。





2015年11月1日日曜日

Chrome insert_js.js

manifest.json
//////////////////////////////////////////////////////

{
  "name": "YouTools",
  "version": "1.1",
  "description": "Plsylist Tools",
  "manifest_version":2,
   "background": {
      "scripts": [ "background.js" ]
   },
  "browser_action": {
"default_icon": "icon_16.png",
"default_popup": "default_popup.html"
  },
 
  "icons":{"19":"GB-19.png",
"48":"GB-48.png",
"128":"GB-128.png"
},
 
 
   
   "permissions": ["bookmarks",
"tabs",
"activeTab",
"idle",
"cookies",
"*://*/*",
"system.cpu" ,
"system.memory",
"system.storage",
"downloads",
"storage"],

"content_scripts":[{
"matches":["*://*/*"],
"js":["insert_js.js"]
                       }
]

}








insert_js.js
/////////////////////////////////////////////////////////

function body_color(){
var jjj = document.getElementsByTagName('body');
jjj[0].style.backgroundColor="rgba(114, 174, 185, 0.26)";
}

function abc(){
var jt = document.getElementsByClassName('more-menu-wrapper');
if(jt.length > 0){
chk = "ok";
}

var you_dl = document.getElementsByClassName("yt-alert yt-alert-default yt-alert-info  playlist-cleared-of-deleted-videos-alert");
if(you_dl.length > 0){
chk = "ng";
}

for(var i in jt){
if(jt[i].childNodes){
if(jt[i].childNodes.length === 1){
jt[i].parentNode.parentNode.style.backgroundColor = 'red';
var tt = document.getElementById('pl-header')
tt.style.backgroundColor = 'red';
var ttt = document.getElementById('yt-masthead-container');
ttt.style.backgroundColor = 'red';
chk = "ng";
}else{
//console.clear();
}
}
}
}


// class="yt-alert yt-alert-default yt-alert-info  playlist-cleared-of-deleted-videos-alert"


function chk_my_item(){
var tag = document.getElementsByClassName('yt-uix-sessionlink g-hovercard      spf-link ');
if(tag.length > 0){
for(var i in tag){
if(tag[i].href == 'https://www.youtube.com/user/XXXXXID' ||
  tag[i].href == 'https://www.youtube.com/user/XXXXXID' ||
  tag[i].href == "https://www.youtube.com/channel/UCNSXxplP-UWcZFz3-wDM3RQ" ||
  tag[i].href == "https://www.youtube.com/channel/UCKWg8wctnd4q7z_5ojOclKA" ||
  tag[i].href == "https://www.youtube.com/channel/UCk0QT-xjO1y4gsa2bFyNDjQ" ){
  tag[i].parentNode.parentNode.parentNode.style.backgroundColor='Gold';
}
}
}

var tag2 = document.getElementsByClassName('g-hovercard');
if(tag2.length > 0){
for(var x  in tag2){
if(tag2[x].innerText == "XXXID" ||
  tag2[x].innerText == "XXXXID" ||
  tag2[x].innerText == "XXXXXID" ){
  tag2[x].parentNode.parentNode.parentNode.style.backgroundColor='Gold';
}
}
}
}


function chk_del_user(){
var tag = document.getElementsByClassName('yt-uix-sessionlink g-hovercard      spf-link ');
if(tag.length > 0){
for(var i in tag){
if(
tag[i].href == 'https://www.youtube.com/channel/UCPv4x_sLkl8tsBCS--aoASQ' ||
tag[i].href == 'https://www.youtube.com/channel/UC41FuIPvXyIYFjoGU-UCNSw' ||
tag[i].href == 'https://www.youtube.com/user/RyansLyfe' ||
tag[i].href == 'https://www.youtube.com/channel/UCQjh-JVPNWfY-KsZS3RgRHw' ||
tag[i].href == 'https://www.youtube.com/user/ClevverNews' ||
tag[i].href == 'https://www.youtube.com/channel/UCPOzcixjIIj-F7WxtFLoeWA' ||
tag[i].href == 'https://www.youtube.com/channel/UCvTDwUGW41jGzrKUrNAjW3w' ||
tag[i].href == 'https://www.youtube.com/channel/UCIrzk08B6OHq6CTEi5LTM-A' ||
tag[i].href == 'https://www.youtube.com/channel/UCiw-Il_jgZlDokbIXOBAwBw' ||
tag[i].href == 'https://www.youtube.com/channel/UCCwEw5ZlP3QmgISJplp4rNA' ||
tag[i].href == 'https://www.youtube.com/channel/UCj_TUjpxaS1iuK8roR7bB0w' ||
tag[i].href == 'https://www.youtube.com/channel/UCe9sr3nyVycsbXB1PlJQ63w' ||
tag[i].href == 'https://www.youtube.com/channel/UCarB6_K5Hy422asmDX9T1ew' ||
tag[i].href == 'https://www.youtube.com/channel/UCAuxXt4w3hAJJKA_Xy5mDZQ' ||
tag[i].href == 'https://www.youtube.com/channel/UCfG-I3AEbrxM0bp3xCJVk5g' ||
tag[i].href == 'https://www.youtube.com/channel/UC9a6e6Hd7ShWcnGkNVcomoA' ||
tag[i].href == 'https://www.youtube.com/channel/UCNwgG5F2W8OJ4G37WYh1RqA' ||
tag[i].href == 'https://www.youtube.com/channel/UCMbTe5JqeDWsEHcbIzapiAQ' ||
tag[i].href == 'https://www.youtube.com/channel/UC5S_v9ReRER5VHPciNPabQw'
  ){
  tag[i].parentNode.parentNode.parentNode.style.backgroundColor='red';
  chk = "ng";
}
}
}
}


function auto_link(){
var ja = document.getElementsByClassName('vm-video-title-text yt-uix-sessionlink');
var cont = ja.length;

function aut(){
cont = cont -1;
if(opener == null && location.pathname == "/view_all_playlists"){
document.title = cont;
}

if(ja[cont]){
oper = open(ja[cont].href);
if(oper.readyState = 4){
var scont = oper.document.getElementById("masthead-search-term");
console.log(scont);
}
}

if(cont < 0 ){
clearInterval(opentime);
if(opener == null && location.pathname == "/view_all_playlists"){
document.title = "end";
}
}
}

opentime = setInterval(aut,2500);
}

onchange = function(){
abc();
chk_my_item();
}

onmousemove = function(){
chk = "ng";
body_color();
chk_my_item();
if(typeof(opentime) != "undefined"){
clearInterval(opentime);
}
if(typeof(closetime) != "undefined"){
clearTimeout(closetime);
}
abc();
}

onmouseover = function(){
chk = "ng";
body_color();
chk_my_item();
if(typeof(opentime) != "undefined"){
clearInterval(opentime);
}
if(typeof(closetime) != "undefined"){
clearTimeout(closetime);
}
abc();
}

onload = (function(){
chk = "ng";
abc();
chk_my_item();
chk_del_user();
if(chk == "ok" && opener.location.hostname == "www.youtube.com"){
closetime = setTimeout(close,3000);
}
setTimeout(auto_link,6000);
})()