哔哩哔哩·猜你喜欢 哔哩哔哩·猜你喜欢

Fun
Version: 1.13
Last Update: 2022-01-12

Overview

哔哩哔哩·猜你喜欢 is a Chrome extension developed by 久远寺千歳. According to the data from Chrome web store, current version of 哔哩哔哩·猜你喜欢 is 1.13, updated on 2022-01-12.
6,000+ users have installed this extension. 45 users have rated this extension with an average rating of .

为你的哔哩哔哩PC首页增加「猜你喜欢」模块

作为被时代抛弃的PC党,每次刷完自己的关注列表后,面对堆满视频的首页却感觉完全没东西可看,这种时候真的好羡慕手机上的猜你喜欢啊!!!
所以我就问了三哥PC首页啥时候才会有猜你喜欢,三哥说计划是有的,但是PC首页流量也很大需要慢慢来 =3=
既然一时半会不会有官方的猜你喜欢,那我们只能自己动手做一个了!

感谢 @April 帮忙画的以假乱真的小电视图标w

** 关于推荐列表为空时占的面积比较大的问题:只要安装这个扩展后随便点击一个视频,然后刷新页面就有推荐视频了,空白只会存在一小会而已

20191125:更新兼容了B站新版首页,暂时没时间细调样式,所以后边会有挺大的空白,等我考完试我会找点时间处理下的!

关键字:bilibili、B站、哔哩哔哩、猜你喜欢

Rating

45 ratings

Total Installs

6,000+

Information

Last Update

2022-01-12

Current Version

1.13

Size

19.62KiB

Author

久远寺千歳

Website

None

Category

Fun

Latest Reviews

See More

avatar Autism
2022-01-29

请问出现这个怎么办

// 插入页面
// 目前看来第一个section class="bili-grid short-margin grid-anchor"是首屏的推荐模块,我们直接插在她下面就可以了
const anchor = document.querySelector('.bili-grid.short-margin.grid-anchor');
if (!anchor)
throw new Error(`$LOG_PREFIX 无法定位首屏推荐模块 section class="bili-grid short-margin grid-anchor"`)

anchor.insertAdjacentElement('afterEnd', node);
UI.node = node;

resolve();
);
,
// 获取推荐模块的引用
getRecommandNode()
return new Promise(async(resolve) =
// 检查是否有已插入的节点
UI.node = document.querySelector('#_bili_guessyoulike');
if (!UI.node)
// 没有就创建
await UI.insertRecommands();

resolve();
);
,
renderVideoCard(video)
function toWan(number)
return number 9999 ? ((number / 10000).toFixed(1) + '万') : number;


function toMin(seconds)
return String(Math.floor(seconds / 60)).padStart(2, '0') + ':' + String(seconds % 60).padStart(2, '0');


function toHttps(url)
return url.replace('http://', 'https://');

return videoCardTemplate.replaceAll('!#bvid', video.bvid)
.replaceAll('!#duration', toMin(video.duration))
.replaceAll('!#title', video.title)
.replaceAll('!#cover', toHttps(video.pic))
.replaceAll('!#view', toWan(video.stat.view))
.replaceAll('!#like', toWan(video.stat.like))
.replaceAll('!#uid', video.up.mid)
.replaceAll('!#avatar', toHttps(video.up.face))
.replaceAll('!#username', video.up.name)
,
async updateRecommands(videos)
await UI.getRecommandNode();
const node = UI.node;
const stage = node.querySelector('.bangumi-activity-body');
if (videos.length)
// 生成视频卡片
const videoCardsHTML = videos.map(video = UI.renderVideoCard(video)).join('');
stage.innerHTML = videoCardsHTML;
else
stage.innerHTML = 'p style="color: #777; line-height: 360px; text-align: center; width: 100%;"观看记录为空,快去看几个视频吧~/p';

,
// 监听来自页面的更新请求
listen()
window.addEventListener('message', (ev) =
if (ev.data.type && ev.data.type == 'UPDATE_RECOMMANDS')
RECOMMAND.recommand(recommandMax);

);



// 在视频页直接点击关联视频并不会刷新页面,而是直接ajax加载改变url,所以我们要监听hashchange
// 试了下hashchange事件好像监听不到?不知道为啥,写个dirty check吧
const URLLISTENER =
timer: null,
bvid: '',
tick()
const bvid = UI.getBVID();
if (bvid !== URLLISTENER.bvid)
DB.logUserViewHistory(bvid);
RECOMMAND.get(bvid);
URLLISTENER.bvid = bvid;
console.log(`$LOG_PREFIX Logged $bvid`);

,
init()
URLLISTENER.timer = setInterval(URLLISTENER.tick, 10000); // 10s检查一次差不多了吧
URLLISTENER.tick();



function init()
// 当前是否首页?
if (UI.isIndex())
RECOMMAND.recommand(recommandMax);
UI.listen();

// 当前是否视频播放页?
// 如果是视频播放页,则获取当前视频的相关推荐视频
if (UI.isVideo())
URLLISTENER.init();



// 增加了bvid字段,需要清除以前的数据
DB.get('_20200325_clear_data', (cleared) =
if (cleared)
init();
else
chrome.storage.local.clear(() =
DB.set( '_20200325_clear_data': true );
init();
);

);

avatar 郁祉峤
2022-01-18

感谢作者更新,新版首页也是配了,排版布局也不变型了,给点个赞。

avatar Yinan Chen
2022-01-13

之前用的挺喜欢的,但是好像新版首页又不能用了

avatar 周润发
2022-01-06

b站更新了 今天发现已经失效 求升级谢谢

avatar
2021-12-28

可以兼容一下B站新版首页吗