mirror of
https://github.com/yusufipk/YouTubeOutlierBadge.git
synced 2026-09-11 10:56:14 +00:00
Score cards and the watch panel again after the player endpoint closed
YouTube now answers the InnerTube `player` endpoint with LOGIN_REQUIRED for requests that carry no session, and the extension deliberately sends none. `videoDetails` therefore returned nothing for almost every video, which broke two things at once: cards on channel pages, where YouTube omits the channel link because you are already on the channel, and the watch page panel, which starts every render with that same call. `next` returns the channel id and the exact view count without a session, so videoDetails reads from there instead. A live stream reports "watching now" in the same field, so that text is filtered out rather than read as a view count. Channel pages no longer need the fallback at all: the cards belong to the channel in the address bar, so pageChannel() reads it from the URL. That also drops one request per card. The panel took the video length from the player response to tell Shorts apart; `next` does not carry it, so it comes from the page's own player element. test/check.js probed videoDetails with dQw4w9WgXcQ, which keeps answering even on the broken endpoint and kept the suite green through all of this. It now probes a current video from the channel it just listed, and asserts the view count as well as the channel id.
This commit is contained in:
+10
-3
@@ -98,6 +98,7 @@ eq(tiny.score, null, "3'ten az örnek: skor yok");
|
||||
|
||||
console.log("\n--- gerçek InnerTube çağrısı ---");
|
||||
const CHANNEL = process.argv[2] || "UCXuqSBlHAE6Xw-yeJA0Tunw"; /* Linus Tech Tips */
|
||||
let probe = null; /* videoDetails'ı sınamak için kanalın güncel bir videosu */
|
||||
OBTube.channelTab(CHANNEL, "videos", 30).then((items) => {
|
||||
console.log("videos sekmesi: " + items.length + " video");
|
||||
const withViews = items.filter((v) => v.views);
|
||||
@@ -108,6 +109,7 @@ OBTube.channelTab(CHANNEL, "videos", 30).then((items) => {
|
||||
console.log(" " + v.videoId + " | " + OBParse.humanCount(v.views) + " | " +
|
||||
(v.ageDays == null ? "?" : v.ageDays.toFixed(1) + " gün") + " | " + v.title.slice(0, 50));
|
||||
}
|
||||
probe = withViews.length ? withViews[0] : null;
|
||||
const views = withViews.map((v) => v.views);
|
||||
console.log("medyan: " + OBParse.humanCount(OBParse.median(views)));
|
||||
if (withViews.length < 10) { fails++; console.log("FAIL izlenmesi çözülen video sayısı çok düşük"); }
|
||||
@@ -118,10 +120,15 @@ OBTube.channelTab(CHANNEL, "videos", 30).then((items) => {
|
||||
return OBTube.resolveChannel("@LinusTechTips");
|
||||
}).then((id) => {
|
||||
eq(id, CHANNEL, "handle -> kanal kimliği");
|
||||
return OBTube.videoDetails("dQw4w9WgXcQ");
|
||||
/* Bilerek kanalın güncel bir videosu: sabit bir klasik ("dQw4w9WgXcQ")
|
||||
* YouTube tarafında ayrıcalıklı davranıp uç bozulduğunda bile yanıt
|
||||
* verebiliyor ve testi yanlış yere yeşil gösteriyordu. */
|
||||
if (!probe) { fails++; console.log("FAIL sınanacak video bulunamadı"); return {}; }
|
||||
return OBTube.videoDetails(probe.videoId);
|
||||
}).then((d) => {
|
||||
console.log("player ucu: kanal " + d.channelId + ", izlenme " + OBParse.humanCount(d.views));
|
||||
if (!d.channelId) { fails++; console.log("FAIL player ucu kanal kimliği vermedi"); }
|
||||
console.log("video ucu: kanal " + d.channelId + ", izlenme " + OBParse.humanCount(d.views));
|
||||
eq(d.channelId, CHANNEL, "video ucu kanal kimliği");
|
||||
if (!d.views) { fails++; console.log("FAIL video ucu izlenme vermedi"); }
|
||||
console.log(fails ? "\n" + fails + " test başarısız" : "\nhepsi geçti");
|
||||
process.exit(fails ? 1 : 0);
|
||||
}).catch((e) => {
|
||||
|
||||
Reference in New Issue
Block a user