Bili You Documentation
repository·main·Indexed 25 days ago
https://github.com/lucinhu/bili_youA third-party Bilibili client developed with Flutter. The project implements Bilibili features including video and anime playback, danmaku, search, and comment sections using official APIs. Documentation covers API base URLs, authentication endpoints, user information retrieval, video interaction (likes, coins, favorites), search functionality for videos and users, and live streaming playback.
What's inside Bili You
- Bili You is a third-party Bilibili client built using the Flutter framework. It provides features such as video recommendations, video search, comment sections (including nested replies), related videos, hot searches, video and anime (bangumi) playback, danmaku (bullet comments), and user submissions.
Customize the iOS launch screen assets
mainTo change the launch screen image for the iOS version of the app, you can either replace the image files directly in theios/Runner/Assets.xcassets/LaunchImage.imageset/directory or use Xcode to manage the assets.Replace launch screen images via Xcode
mainTo replace the launch screen images using the Xcode graphical interface:
- Open the iOS project workspace by running
open ios/Runner.xcworkspacein your terminal. - In the Xcode Project Navigator, navigate to
Runner/Assets.xcassets. - Drag and drop your desired image files into the asset catalog to replace the existing launch screen assets.
open ios/Runner.xcworkspace- Open the iOS project workspace by running
Initialize and run the Bili You application
mainThe application entrypoint requires initializing several asynchronous services before running the Flutter app:
BiliYouStorage,MediaKit, andWidgetsFlutterBinding. It also configures the system UI for an edge-to-edge immersive experience (transparent status and navigation bars) and locks the device orientation to portrait mode.void main() async { WidgetsFlutterBinding.ensureInitialized(); await BiliYouStorage.ensureInitialized(); MediaKit.ensureInitialized(); runApp(const MyApp()); SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge); SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle( systemNavigationBarColor: Colors.transparent, systemNavigationBarDividerColor: Colors.transparent, statusBarColor: Colors.transparent, )); }Retrieve User Information and Stats
mainAccess user-related data using these endpoints:
userInfo: Get current user information ($apiBase/x/web-interface/nav).userStat: Get user statistics such as dynamic count, following count, and follower count ($apiBase/x/web-interface/nav/stat).followings: Get the user's following list ($apiBase/x/relation/followings).followers: Get the user's follower list ($apiBase/x/relation/followers).
Live Streaming Endpoints
mainEndpoints for Bilibili Live services:
userRecommendLive: Get live stream recommendations for the user.livePlayUrl: Get live stream playback information.
livePlayUrlParameters:room_id: The ID of the room (passed ascid).qn: Quality setting (e.g.,80: Smooth,150: HD,400: Blu-ray,10000: Original,20000: 4K,30000: Dolby).
Search for users with `SearchApi.getSearchUsers()`
mainSearches for users based on a keyword. Returns a
List<SearchUserItem>. Each item includes:mid: User ID.name: Username.face: User avatar URL (prefixed withhttp:).sign: User signature.fansCount: Number of fans.videoCount: Number of videos.level: User level.gender: User gender.isUpper: Boolean indicating if they are an uploader.isLive: Boolean indicating if they are currently live.roomId: Live room ID if applicable.officialVerify: Details about official verification status.
Access BiliYouStorage boxes
mainOnce initialized, you can access the following Hive boxes via the
BiliYouStorageclass to read or write data:BiliYouStorage.user: Stores user-related information.BiliYouStorage.networkData: Stores network-related data.BiliYouStorage.settings: Stores application settings.BiliYouStorage.history: Stores user history.
Search for videos with `SearchApi.getSearchVideos()`
mainSearches for videos using a keyword, page number, and sort order. Returns a
List<SearchVideoItem>. Each item includes:coverUrl: The video cover image URL (prefixed withhttp:).title: The video title (sanitized).bvid: The Bilibili video ID.upName: The author's name.timeLength: Duration in seconds.playNum: Play count.pubDate: Publication date timestamp.
Like or unlike a reply with addLike()
mainUse
addLiketo toggle a like/unlike action on a specific reply.Parameters:
type: TheReplyTypeof the comment section.oid: The target object ID (e.g., video ID).rpid: The specific reply ID.likeOrUnlike: A boolean wheretrueperforms a like andfalseperforms an unlike.
Returns a
ReplyAddLikeResultcontainingisSuccessand anerrormessage.Get hot words list with `SearchApi.getHotWords()`
mainRetrieves a list of currently trending hot words. Returns aList<HotWordItem>where each item containskeyWordandshowWord.Configure MyApp for Bili You
mainThe
MyAppwidget serves as the root of the application. It usesGetMaterialAppfor state management and navigation. Key configuration features include:- HTTP Initialization:
HttpUtils().init()is called duringonInit. - Dynamic Theming: Uses
DynamicColorBuilderto support system-level dynamic colors. The theme is determined bySettingsUtil.currentTheme. If set toBiliTheme.dynamic, it uses the device's dynamic color scheme. - Text Scaling: A custom
builderapplies a globaltextScaleFactorretrieved fromSettingsStorageKeys.textScaleFactorviaSettingsUtil.getValue. - Navigation: Uses
BiliVideoPage.routeObserverfor route monitoring.
class MyApp extends StatelessWidget { const MyApp({super.key}); @override Widget build(BuildContext context) { return DynamicColorBuilder(builder: ((lightDynamic, darkDynamic) { return GetMaterialApp( onInit: () async { await HttpUtils().init(); }, navigatorObservers: [BiliVideoPage.routeObserver], themeMode: SettingsUtil.currentThemeMode, theme: ThemeData( colorScheme: SettingsUtil.currentTheme == BiliTheme.dynamic ? lightDynamic ?? BiliTheme.dynamic.themeDataLight.colorScheme : SettingsUtil.currentTheme.themeDataLight.colorScheme, useMaterial3: true), darkTheme: ThemeData( colorScheme: SettingsUtil.currentTheme == BiliTheme.dynamic ? darkDynamic ?? BiliTheme.dynamic.themeDataDark.colorScheme : SettingsUtil.currentTheme.themeDataDark.colorScheme, useMaterial3: true), home: const MainPage(), builder: (context, child) => child == null ? const SizedBox() : MediaQuery( data: MediaQuery.of(context).copyWith( textScaleFactor: MediaQuery.of(context).textScaleFactor * SettingsUtil.getValue( SettingsStorageKeys.textScaleFactor, defaultValue: 1.0)), child: child)); })); } }- HTTP Initialization: