通常我们要 stalk 别人的订阅频道, 都是去简介, 如图所示, 这家伙订阅了 4 个频道。
可是有些人的订阅是非常多的。比如说这家伙 https://www.youtube.com/user/milmiLxX/about
这时候就有问题了, 因为你会发现顶多只能看 99 或 100 个频道。又没有下一页的按钮之类的东西。
可能你会说, 活动栏目也应该能看完他的所有订阅
但是太麻烦了,因为没有 "订阅频道" 活动类型给你过滤, 所以要从所有活动大海捞针找, 眼睛都痛。
现在就教你非常简单的方法。
在那个人的专页里, 随便右键按一个地方, 选 Inspect Element。 如果没有这个选项, 直接按 F12 键也可以。
浏览器下面会跑出来新的窗口, 拖拉把窗口拉大, 找 Console 栏目。
把下面的代码一字不漏选完, 然后 copy
var index = 1; var FirstPage = true; var cid = 1; var obj = ""; var channelId = ""; var month = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']; function subGui(e) { function loop(li2, e) { var li = li_create("outside"); var ul = d.createElement("ul"); ul.style.listStyleType = "none"; //rm bullet var div3 = div_create("", "", "", "", "110px", "104px"); var title = e.yt$username.display || ""; var description = e.yt$countHint.$t || ""; if (description) { description = description + ' videos'; //oso int to str } else { description = 'No video'; } var channelIdE = e.yt$channelId.$t || ""; var link = "https://www.youtube.com/channel/" + channelIdE; var jpg = e.media$thumbnail.url || ""; var pub = e.published.$t || ""; if (pub) { var dT = new Date(); dT.setTime(Date.parse(pub)); gname = 'Subscribed on ' + month[dT.getMonth()] + ' ' + dT.getDate() + ', ' + dT.getFullYear() + ' at ' + dT.toTimeString().split(" ")[0]; } else { gname = ''; } var im = img_create("0", "0", "100px", "100px", jpg, jpg); var div = div_create("center", "100px", "100px"); var a = a_create(jpg); var div2 = div_create("center", "102px", "102px", "left"); var a_title = a_create(link, title); var span = d.createElement("span"); span.appendChild(a_title); var div4 = div_create("", "", "", "", "", "", "hidden", "normal"); div4.appendChild(span); var gname = d.createTextNode(gname); var cite = d.createElement("cite"); cite.style.color = "#006621"; cite.style.fontStyle = "normal"; cite.appendChild(gname); var div5 = div_create("", "", "", "", "", "", "", "", "2px"); div5.appendChild(cite); var desc = d.createTextNode(description); var span2 = d.createElement("span"); span2.appendChild(desc); var div6 = div_create("", "", "", "", "", "", "", "", "", "509px", "1px 0 4px"); div6.appendChild(span2); div.appendChild(im); a.appendChild(div); div2.appendChild(a); li2.appendChild(div2); //left side pic li.appendChild(div4); //title li.appendChild(div5); //date li.appendChild(div6); //video(s) count ul.appendChild(li); div3.appendChild(ul); li2.appendChild(div3); //right side text area } function loop2(ol, e) { var li2 = li_create("outside"); loop(li2, e); ol.appendChild(li2); } var ol = d.createElement("ol"); ol.start = "" + index; //int to str loop2(ol, e); docBody.appendChild(ol); index++; } function set_info() { docBody.innerHTML = ""; docHead.innerHTML = '<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head>'; var profURL = "https://www.youtube.com/channel/UC" + channelId; var title = obj.feed.title.$t + ' (~ ' + obj.feed.openSearch$totalResults.$t + ' channels)'; profImgT = "https://i.ytimg.com/i/" + channelId + "/1.jpg"; var profImg = img_create("0", "0", "100px", "100px", profImgT, profURL); docBody.appendChild(profImg); var a_user = a_create(profURL, title); var h3 = d.createElement("h3"); h3.style.display = "block"; h3.appendChild(a_user); docBody.appendChild(h3); //tab title } function img_create(m, b, w, h, sc, t) { var i = d.createElement('img'); sc = sc || ""; t = t || ""; i.style.margin = m; i.style.border = b; i.style.width = w; i.style.height = h; i.src = sc; i.title = t; return i; } function a_create(h, t) { var a = d.createElement("a"); if (h != null) a.href = h; a.target = "_blank"; if (t != null) { var link_text = d.createTextNode(t); a.appendChild(link_text); } return a; } function div_create(t, w, h, f, ml, mh, ov, ws, pt, mw, m) { var dv = d.createElement("div"); if (t != null) dv.style.textAlign = t; if (f != null) dv.style.setProperty('float', f); //resevered word float failed in firefox if (w != null) dv.style.width = w; if (h != null) dv.style.height = h; if (ml != null) dv.style.marginLeft = ml; if (mh != null) dv.style.minHeight = mh; if (ws != null) dv.style.whiteSpace = ws; if (pt != null) dv.style.paddingTop = pt; if (mw != null) dv.style.maxWidth = mw; if (m != null) dv.style.margin = m; return dv; } function li_create(lsp) { var l = d.createElement("li"); l.style.listStylePosition = lsp; return l; } function sub_tab() { if (!FirstPage) { pid = "&start-index=" + cid; var m = document.getElementById("moreButton"); m.parentNode.removeChild(m); //rm prev btn } else { pid = "&start-index=1"; } var su = 'https://gdata.youtube.com/feeds/api/users/'+uid+'/subscriptions?v=2&alt=json&max-results=50' + pid; console.log("Requesting..." + su); var xhr = new XMLHttpRequest(); xhr.open("GET", su); xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xhr.send(); xhr.onreadystatechange = function () { if (xhr.readyState == 4) { var da = xhr.status; if (da == 200) { d = document; docBody = d.getElementsByTagName("body")[0]; docHead = d.getElementsByTagName("head")[0]; var r = xhr.responseText; obj = JSON.parse(r); //obj.feed.title.$t if ("entry" in obj.feed) { if (FirstPage) { FirstPage = false; channelId = obj.feed.author[0].yt$userId.$t; set_info(); } var e = obj.feed.entry; for (var i = 0; i < e.length; i++) { subGui(e[i]); } if (obj.feed.openSearch$totalResults.$t > cid) { cid = cid + 50 var moreBtn = d.createElement("input"); moreBtn.id = "moreButton"; moreBtn.type = "button"; moreBtn.value = "More 更多"; moreBtn.onclick = sub_tab; docBody.appendChild(moreBtn); } else { cid = 0 } } else if (FirstPage) { channelId = obj.feed.author[0].yt$userId.$t; set_info(); FirstPage = false var unav_text = d.createTextNode("Nothing :("); docBody.appendChild(unav_text); } } } } } try { var uid = window.location.href.split(/\/channel\/|\/user\//)[1].split(/\/|\?|#/)[0]; } catch (err) {} if (uid) { console.log("[0] User id is:" + uid); sub_tab() } else { console.log("Failed to recognize user id"); }
paste 在 Console 栏目的箭头 >> 的右边. 如下图所示。
按ENTER键。代码就会开始运行, 然后会看见那个人的订阅页面。
这个方法最变态的地方是, 可以看见那个人在何年何月何日, 精准到几分几秒订阅。
一次最多只能显示 50 个以下 频道。 如果要看更多频道, 可以按 More 更多的按钮。一直按到按钮消失了, 就表示到底了。
开头的题目写了 Subscriptions of Dennis Lim Ming (~ 462 channels) , 表示大约 ~ 462 频道, 但是通常都是少一些的。其实只有 453 个频道。
如果你在简介页面看不到任何频道, 代码就不会有任何反应,比如说 name wee 。https://www.youtube.com/user/namewee/about
原因可以两种, 一是他没有任何订阅,二是他的订阅设置打勾不公开。
干杯 :)
No comments:
Post a Comment