BIP API Documentation
BIP API Documentation
BIP stands for Bilibili Image Proxy.
/
Parameter:
GET Query String url - image URL to proxy, for example: http://i0.hdslb.com/bfs/archive/....jpg
Limitations: the url must starts with the following domains:
- i0.hdslb.com
- i1.hdslb.com
- i2.hdslb.com
Explaination:
After receiving a qualified GET request, this API will use cURL to get the image of the specified url and return the content responded to the client.
In order to bypass the Referer restrictions of bilibili image server and allow any referer to load images, this API backend adds the following headers:
- Referer: https://www.bilibili.com
- User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36
- Connection: keep-alive
All images requested by the proxy will be cached on the server, unless the server reaches the cache limit of 2000 images (which is about 4GB and 2MB per image), then the server will delete the oldest 100 images from the server and continue.
Please note: If the URL does not contain @ (a bilibili image parameter), the server will automatically add the suffix @672w_378h_1c_!web-home-common-cover.avif to get the 672*378 size avif format video cover image, which helps reduce bandwidth and space usage.
If there is no problem, the server will return the image in streaming and add a cache header:
Cache-Control: public, max-age=604800, stale-while-revalidate=3600
Which will cache the image on the client for 7 days.
/info
Parameter:
**GET Query String bvid - Bilibili Video ID (BV号, starts with BV...)
Explaination:
After receiving a correct bvid, this API will fetch https://api.bilibili.com/x/web-interface/view?bvid={bvid} and return the server response.
All the responses would be cached on the server unless 1000 file limit is reached. This is for the purpose of speeding up the respond time, but it may cause delayed or misleading data.
Use with caution.
This is for bypassing the limitation of api.bilibili.com to send video query to bilibili api directly through user's browser. To accomplish that, serveral headers are added in backend request:
- Referer: https://www.bilibili.com
- User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36
- Connection: keep-alive