Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
lasers
NewPipeExtractor
Commits
f82eda9f
Unverified
Commit
f82eda9f
authored
Oct 16, 2020
by
Tobias Groza
Committed by
GitHub
Oct 16, 2020
Browse files
Merge pull request #415 from wb9688/fix-ytinitialdata
Fix parsing new ytInitialData
parents
1a9bc8ca
be9a6f93
Changes
1
Show whitespace changes
Inline
Side-by-side
extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeParsingHelper.java
View file @
f82eda9f
...
...
@@ -197,8 +197,13 @@ public class YoutubeParsingHelper {
public
static
JsonObject
getInitialData
(
String
html
)
throws
ParsingException
{
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
);
}
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
)
{
throw
new
ParsingException
(
"Could not get ytInitialData"
,
e
);
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment