@@ -140,19 +140,35 @@ class DouyinSite implements LiveSite {
140140 var ids = category.id.split (',' );
141141 var partitionId = ids[0 ];
142142 var partitionType = ids[1 ];
143+
144+ String serverUrl =
145+ "https://live.douyin.com/webcast/web/partition/detail/room/v2/" ;
146+ var uri = Uri .parse (serverUrl)
147+ .replace (scheme: "https" , port: 443 , queryParameters: {
148+ "aid" : '6383' ,
149+ "app_name" : "douyin_web" ,
150+ "live_id" : '1' ,
151+ "device_platform" : "web" ,
152+ "language" : "zh-CN" ,
153+ "enter_from" : "link_share" ,
154+ "cookie_enabled" : "true" ,
155+ "screen_width" : "1980" ,
156+ "screen_height" : "1080" ,
157+ "browser_language" : "zh-CN" ,
158+ "browser_platform" : "Win32" ,
159+ "browser_name" : "Edge" ,
160+ "browser_version" : "125.0.0.0" ,
161+ "browser_online" : "true" ,
162+ "count" : '15' ,
163+ "offset" : ((page - 1 ) * 15 ).toString (),
164+ "partition" : partitionId,
165+ "partition_type" : partitionType,
166+ "req_from" : '2'
167+ });
168+ var requestUrl = await getAbogusUrl (uri.toString ());
169+
143170 var result = await HttpClient .instance.getJson (
144- "https://live.douyin.com/webcast/web/partition/detail/room/v2/" ,
145- queryParameters: {
146- "aid" : 6383 ,
147- "app_name" : "douyin_web" ,
148- "live_id" : 1 ,
149- "device_platform" : "web" ,
150- "count" : 15 ,
151- "offset" : (page - 1 ) * 15 ,
152- "partition" : partitionId,
153- "partition_type" : partitionType,
154- "req_from" : 2
155- },
171+ requestUrl,
156172 header: await getRequestHeaders (),
157173 );
158174
@@ -175,31 +191,47 @@ class DouyinSite implements LiveSite {
175191
176192 @override
177193 Future <LiveCategoryResult > getRecommendRooms ({int page = 1 }) async {
194+ String serverUrl =
195+ "https://live.douyin.com/webcast/web/partition/detail/room/v2/" ;
196+ var uri = Uri .parse (serverUrl)
197+ .replace (scheme: "https" , port: 443 , queryParameters: {
198+ "aid" : '6383' ,
199+ "app_name" : "douyin_web" ,
200+ "live_id" : '1' ,
201+ "device_platform" : "web" ,
202+ "language" : "zh-CN" ,
203+ "enter_from" : "link_share" ,
204+ "cookie_enabled" : "true" ,
205+ "screen_width" : "1980" ,
206+ "screen_height" : "1080" ,
207+ "browser_language" : "zh-CN" ,
208+ "browser_platform" : "Win32" ,
209+ "browser_name" : "Edge" ,
210+ "browser_version" : "125.0.0.0" ,
211+ "browser_online" : "true" ,
212+ "count" : '15' ,
213+ "offset" : ((page - 1 ) * 15 ).toString (),
214+ "partition" : '720' ,
215+ "partition_type" : '1' ,
216+ "req_from" : '2'
217+ });
218+ var requestUrl = await getAbogusUrl (uri.toString ());
219+
178220 var result = await HttpClient .instance.getJson (
179- "https://live.douyin.com/webcast/feed/" ,
180- queryParameters: {
181- "aid" : "6383" ,
182- "app_name" : "douyin_web" ,
183- "need_map" : "1" ,
184- "is_draw" : "1" ,
185- "inner_from_drawer" : "0" ,
186- "enter_source" : "web_homepage_hot_web_live_card" ,
187- "source_key" : "web_homepage_hot_web_live_card"
188- },
221+ requestUrl,
189222 header: await getRequestHeaders (),
190223 );
191224
192- var hasMore = (result["data" ] as List ).length >= 15 ;
225+ var hasMore = (result["data" ][ "data" ] as List ).length >= 15 ;
193226 var items = < LiveRoomItem > [];
194- for (var i in result["data" ]) {
195- var item = i['data' ];
227+ for (var item in result["data" ]["data" ]) {
196228 var roomItem = LiveRoomItem (
197- roomId: item["owner" ][ " web_rid" ],
198- title: item["title" ].toString (),
199- cover: item["cover" ]["url_list" ][0 ].toString (),
200- userName: item["owner" ]["nickname" ].toString (),
229+ roomId: item["web_rid" ],
230+ title: item["room" ][ " title" ].toString (),
231+ cover: item["room" ][ " cover" ]["url_list" ][0 ].toString (),
232+ userName: item["room" ][ " owner" ]["nickname" ].toString (),
201233 online: int .tryParse (
202- item["room_view_stats" ]["display_value" ].toString ()) ??
234+ item["room" ][ " room_view_stats" ]["display_value" ].toString ()) ??
203235 0 ,
204236 );
205237 items.add (roomItem);
@@ -448,32 +480,35 @@ class DouyinSite implements LiveSite {
448480 /// 通过webRid获取直播间Web信息
449481 /// - [webRid] 直播间RID
450482 Future <Map > _getRoomDataByApi (String webRid) async {
483+ String serverUrl = "https://live.douyin.com/webcast/room/web/enter/" ;
484+ var uri = Uri .parse (serverUrl)
485+ .replace (scheme: "https" , port: 443 , queryParameters: {
486+ "aid" : '6383' ,
487+ "app_name" : "douyin_web" ,
488+ "live_id" : '1' ,
489+ "device_platform" : "web" ,
490+ "enter_from" : "web_live" ,
491+ "web_rid" : webRid,
492+ "room_id_str" : "" ,
493+ "enter_source" : "" ,
494+ "Room-Enter-User-Login-Ab" : '0' ,
495+ "is_need_double_stream" : 'false' ,
496+ "cookie_enabled" : 'true' ,
497+ "screen_width" : '1980' ,
498+ "screen_height" : '1080' ,
499+ "browser_language" : "zh-CN" ,
500+ "browser_platform" : "Win32" ,
501+ "browser_name" : "Edge" ,
502+ "browser_version" : "125.0.0.0"
503+ });
504+ var requestUrl = await getAbogusUrl (uri.toString ());
505+
451506 var requestHeader = await getRequestHeaders ();
452507 var result = await HttpClient .instance.getJson (
453- "https://live.douyin.com/webcast/room/web/enter/" ,
454- //2025-08-02 dy_server checks the existence of the parameter "a_bogus" but doesn't check its value
455- queryParameters: {
456- "aid" : 6383 ,
457- "app_name" : "douyin_web" ,
458- "live_id" : 1 ,
459- "device_platform" : "web" ,
460- "enter_from" : "web_live" ,
461- "web_rid" : webRid,
462- "room_id_str" : "" ,
463- "enter_source" : "" ,
464- "Room-Enter-User-Login-Ab" : 0 ,
465- "is_need_double_stream" : false ,
466- "cookie_enabled" : true ,
467- "screen_width" : 1980 ,
468- "screen_height" : 1080 ,
469- "browser_language" : "zh-CN" ,
470- "browser_platform" : "Win32" ,
471- "browser_name" : "Edge" ,
472- "browser_version" : "125.0.0.0" ,
473- "a_bogus" : "0"
474- },
508+ requestUrl,
475509 header: requestHeader,
476510 );
511+
477512 return result["data" ];
478513 }
479514
0 commit comments