Skip to content

Commit

Permalink
Merge pull request #86 from ztxtxwd/master
Browse files Browse the repository at this point in the history
update v2.18.1 20220808适配最新抖音版本
  • Loading branch information
nICEnnnnnnnLee authored Aug 8, 2022
2 parents d4802dd + 838f04e commit aa7b488
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/release.info
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* 修复[#72](/~https://github.com/nICEnnnnnnnLee/BilibiliLiveRecorder/issues/72):修复斗鱼部分区域获取链接为m3u8的问题
* 修复[#86](/~https://github.com/nICEnnnnnnnLee/BilibiliLiveRecorder/issues/86):适配最新抖音版本
4 changes: 2 additions & 2 deletions .github/release.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"tag_main": "2.18.0",
"tag_latest": "2.18.0"
"tag_main": "2.18.1",
"tag_latest": "2.18.1"
}
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>top.nicelee</groupId>
<artifactId>live-record</artifactId>
<version>2.18.0</version>
<version>2.18.1</version>
<name>iLiveRecord</name>
<description>B站、Acfun、斗鱼、虎牙、快手、抖音直播录制</description>
<properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class RoomDealerDouyin4User extends RoomDealer {

final public static String liver = "douyin";

final static Pattern pJson = Pattern.compile("<script id=\"RENDER_DATA\".*>(.*?)</script></head>");
final static Pattern pJson = Pattern.compile("<script id=\"RENDER_DATA\".*>(.*?%7D)</script>");
final static Pattern pShortId = Pattern.compile("live.douyin.com/([0-9]+)");

final static Pattern pJsonMobile = Pattern.compile("<script>window.__INIT_PROPS__ *= *(.*?)</script>");
Expand Down Expand Up @@ -88,7 +88,9 @@ public RoomInfo getRoomInfo(String shortId) {
String json_str = URLDecoder.decode(matcher.group(1), "UTF-8");
Logger.println(json_str);
JSONObject json = new JSONObject(json_str);
JSONObject info = json.getJSONObject("initialState").getJSONObject("roomStore").getJSONObject("roomInfo");
//有时结构会发生变化
boolean app = json.has("app");
JSONObject info = app?json.getJSONObject("app").getJSONObject("initialState").getJSONObject("roomStore").getJSONObject("roomInfo"):json.getJSONObject("initialState").getJSONObject("roomStore").getJSONObject("roomInfo");

JSONObject anchor = info.getJSONObject("anchor");
JSONObject room = info.getJSONObject("room");
Expand Down Expand Up @@ -177,7 +179,8 @@ public String getLiveUrl(String roomId, String qn, Object... obj) {
matcher.find();
String json_str = URLDecoder.decode(matcher.group(1), "UTF-8");
JSONObject json = new JSONObject(json_str);
JSONObject info = json.getJSONObject("initialState").getJSONObject("roomStore").getJSONObject("roomInfo");
boolean app = json.has("app");
JSONObject info = app?json.getJSONObject("app").getJSONObject("initialState").getJSONObject("roomStore").getJSONObject("roomInfo"):json.getJSONObject("initialState").getJSONObject("roomStore").getJSONObject("roomInfo");
stream_url = info.getJSONObject("room").optJSONObject("stream_url");
}

Expand Down

0 comments on commit aa7b488

Please sign in to comment.