Skip to content

Commit

Permalink
ニコ動視聴ページリニューアル(2024/08/05)対応
Browse files Browse the repository at this point in the history
- 各種情報が data-api-data からserver-response に移動したので修正
  • Loading branch information
nnn-revo2012 committed Aug 5, 2024
1 parent 97eae6b commit 304c8f1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
4 changes: 2 additions & 2 deletions frontend/src/saccubus/MainFrame_AboutBox.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ public class MainFrame_AboutBox extends JDialog implements ActionListener {

// String version = "ver1.22r(2008/04/27)";

public static final String rev = "1.70.0.18";
private static final String modefied = " (2024/04/27)";
public static final String rev = "1.70.0.19";
private static final String modefied = " (2024/08/06)";

String productHTML =
"<html>" +
Expand Down
16 changes: 7 additions & 9 deletions frontend/src/saccubus/net/NicoClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -3221,13 +3221,10 @@ private String getDataApiJson(){
*/
private String getDataApiData(String text, String encoding, String comment){
// 動画ページのJSONを取り出す
text = getXmlElement1(text, "body"); //body
if(text==null)
return null;
text = getXmlAttribute(text, "data-api-data");
//div id="js-initial-watch-data" data-api-data="{
//text = getXmlAttribute(text, "data-api-data");
text = getXmlAttribute(text, "server-response"); //2024.8.5
if(text==null){
log.println("error: not found data-api-data");
log.println("error: not found server-response");
return null;
}
int start = text.indexOf(JSON_START2);
Expand All @@ -3239,7 +3236,7 @@ private String getDataApiData(String text, String encoding, String comment){
int end = (text+json_end).indexOf(json_end, start); // end of JSON
text = (text+json_end).substring(start, end);
if(text==null || text.isEmpty()){
log.println("error: not found dataApi JSON2");
log.println("error: not found server-response JSON2");
return null;
}
text = text.replace("&quot;", S_QUOTE2);
Expand Down Expand Up @@ -3460,8 +3457,9 @@ public String getXmlElement2(String input, String key){
return null;
}

private String getXmlAttribute(String input, String atribname){
Pattern p = Pattern.compile("<[^>]*"+atribname+"=\"([^\"]+)\"[^>]*>",Pattern.DOTALL);
private String getXmlAttribute(String input, String key){
Pattern p = Pattern.compile("\""+key+"\" content=\"([^\"]+)\"",Pattern.DOTALL);
log.print(p.toString());
Matcher m = p.matcher(input);
if(m.find())
return m.group(1);
Expand Down

0 comments on commit 304c8f1

Please sign in to comment.