mirror of
https://github.com/TeamNewPipe/NewPipeExtractor.git
synced 2024-12-15 06:40:33 +05:30
Fix parsing new ytInitialData
This commit is contained in:
parent
1a9bc8caf1
commit
be9a6f931c
@ -197,8 +197,13 @@ public class YoutubeParsingHelper {
|
|||||||
|
|
||||||
public static JsonObject getInitialData(String html) throws ParsingException {
|
public static JsonObject getInitialData(String html) throws ParsingException {
|
||||||
try {
|
try {
|
||||||
String initialData = Parser.matchGroup1("window\\[\"ytInitialData\"\\]\\s*=\\s*(\\{.*?\\});", html);
|
try {
|
||||||
|
final String initialData = Parser.matchGroup1("window\\[\"ytInitialData\"\\]\\s*=\\s*(\\{.*?\\});", html);
|
||||||
return JsonParser.object().from(initialData);
|
return JsonParser.object().from(initialData);
|
||||||
|
} catch (Parser.RegexException e) {
|
||||||
|
final String initialData = Parser.matchGroup1("var\\s*ytInitialData\\s*=\\s*(\\{.*?\\});", html);
|
||||||
|
return JsonParser.object().from(initialData);
|
||||||
|
}
|
||||||
} catch (JsonParserException | Parser.RegexException e) {
|
} catch (JsonParserException | Parser.RegexException e) {
|
||||||
throw new ParsingException("Could not get ytInitialData", e);
|
throw new ParsingException("Could not get ytInitialData", e);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user