Skip to main content

Bilibili Avatar as a Service

提供一个用户 UID,即返回对应的哔哩哔哩用户头像,该 API 主要用于 LAPLACE Chat 弹幕机 中部分事件的头像显示

  • API Base: https://workers.vrp.moe/api/bilibili/avatar/<uid>
  • Params
    • uid: 用户 UID
  • Queries
    • size?: 头像尺寸,默认为 240
  • Caching: 3600 秒

Why?

由于哔哩哔哩的头像图片并不允许 CORS 跨域调用,并且头像 URL 以 hash 的形式无序提供,因此需要一个中间服务来代理头像图片的获取

Live Editor
function Avatar() {
  return (
    <img
      src={`https://workers.vrp.moe/api/bilibili/avatar/2132180406`}
      referrerPolicy='no-referrer'
      loading='lazy'
      alt='头像'
    />
  )
}
Result
Loading...