YouTube channels: follow = watchlist only (clean toast) + drop the misleading '90 videos'
Two reports: - 'Following · 0 videos added' toast: following from the channel page sent a stub with no videos, so 0 were wished. Watchlisting a channel shouldn't bulk- wish its whole catalog anyway (that conflates watchlist/track with wishlist/ acquire, unlike TV shows). follow() now sends only the channel fields and the toast reads 'Added to watchlist'. Videos are wished explicitly via + Wish. - '90 videos' in every channel header: that was just our fetch cap (limit=90), not the real total — YouTube no longer exposes a trustworthy channel video count (videoCountText reports a shelf count: 142 for Veritasium, 71 for MrBeast). Dropped it; the accurate subscriber count already conveys the channel's scale.
This commit is contained in:
parent
c00df179ba
commit
91bd895e52
3 changed files with 11 additions and 4 deletions
|
|
@ -167,7 +167,8 @@
|
||||||
meta.push('<span class="vd-status vd-status--yt">YouTube</span>');
|
meta.push('<span class="vd-status vd-status--yt">YouTube</span>');
|
||||||
var yc = window.VideoYoutube;
|
var yc = window.VideoYoutube;
|
||||||
var subs = yc && yc.compactCount(d.subscriber_count); if (subs) meta.push('<span>' + subs + ' subscribers</span>');
|
var subs = yc && yc.compactCount(d.subscriber_count); if (subs) meta.push('<span>' + subs + ' subscribers</span>');
|
||||||
if (d.video_count != null) meta.push('<span>' + esc(d.video_count) + ' videos</span>');
|
// NB: no "N videos" — YouTube doesn't expose a reliable total, and what we
|
||||||
|
// fetch is just the recent page (the cap), so showing it would mislead.
|
||||||
var views = yc && yc.compactCount(d.view_count); if (views) meta.push('<span>' + views + ' views</span>');
|
var views = yc && yc.compactCount(d.view_count); if (views) meta.push('<span>' + views + ' views</span>');
|
||||||
if (d.handle) meta.push('<span>' + esc(d.handle) + '</span>');
|
if (d.handle) meta.push('<span>' + esc(d.handle) + '</span>');
|
||||||
var mm = q('[data-vd-meta]'); if (mm) mm.innerHTML = meta.join('');
|
var mm = q('[data-vd-meta]'); if (mm) mm.innerHTML = meta.join('');
|
||||||
|
|
@ -1461,7 +1462,7 @@
|
||||||
else yc.follow({ youtube_id: ch.youtube_id, title: ch.title, avatar_url: ch.avatar_url }).then(function (d) {
|
else yc.follow({ youtube_id: ch.youtube_id, title: ch.title, avatar_url: ch.avatar_url }).then(function (d) {
|
||||||
if (d && d.success) {
|
if (d && d.success) {
|
||||||
data.following = true; renderActions(data); // toggle in place — no page reload
|
data.following = true; renderActions(data); // toggle in place — no page reload
|
||||||
if (typeof showToast === 'function') showToast('Following · ' + (d.added_videos || 0) + ' videos added', 'success');
|
if (typeof showToast === 'function') showToast('Added to watchlist', 'success');
|
||||||
document.dispatchEvent(new CustomEvent('soulsync:video-wishlist-changed'));
|
document.dispatchEvent(new CustomEvent('soulsync:video-wishlist-changed'));
|
||||||
}
|
}
|
||||||
}).catch(function () { /* ignore */ });
|
}).catch(function () { /* ignore */ });
|
||||||
|
|
|
||||||
|
|
@ -248,7 +248,7 @@
|
||||||
if (d && d.success) {
|
if (d && d.success) {
|
||||||
btn.classList.add('vyt-follow--on'); btn.innerHTML = '✓ Following';
|
btn.classList.add('vyt-follow--on'); btn.innerHTML = '✓ Following';
|
||||||
if (typeof showToast === 'function')
|
if (typeof showToast === 'function')
|
||||||
showToast('Following ' + lastChannel.title + ' · ' + (d.added_videos || 0) + ' videos added', 'success');
|
showToast('Added ' + lastChannel.title + ' to watchlist', 'success');
|
||||||
}
|
}
|
||||||
done();
|
done();
|
||||||
}).catch(function () { btn.disabled = false; });
|
}).catch(function () { btn.disabled = false; });
|
||||||
|
|
|
||||||
|
|
@ -106,7 +106,13 @@
|
||||||
body: JSON.stringify(body || {}) }).then(function (r) { return r.ok ? r.json() : null; });
|
body: JSON.stringify(body || {}) }).then(function (r) { return r.ok ? r.json() : null; });
|
||||||
}
|
}
|
||||||
|
|
||||||
function follow(channel) { return post('/api/video/youtube/follow', { channel: channel }); }
|
// Following a channel WATCHLISTS it (like a show) — it doesn't auto-wish all
|
||||||
|
// its videos, so we send only the channel fields, not its video list.
|
||||||
|
function follow(channel) {
|
||||||
|
var ch = channel || {};
|
||||||
|
return post('/api/video/youtube/follow',
|
||||||
|
{ channel: { youtube_id: ch.youtube_id, title: ch.title, avatar_url: ch.avatar_url } });
|
||||||
|
}
|
||||||
function unfollow(youtubeId) { return post('/api/video/youtube/unfollow', { youtube_id: youtubeId }); }
|
function unfollow(youtubeId) { return post('/api/video/youtube/unfollow', { youtube_id: youtubeId }); }
|
||||||
function removeWish(scope, sourceId) {
|
function removeWish(scope, sourceId) {
|
||||||
return post('/api/video/youtube/wishlist/remove', { scope: scope, source_id: sourceId });
|
return post('/api/video/youtube/wishlist/remove', { scope: scope, source_id: sourceId });
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue