-
-
Notifications
You must be signed in to change notification settings - Fork 485
Refactor date parsing #1372
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Refactor date parsing #1372
Conversation
cadda5e
to
380c303
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks
final String dateStr = playerMicroFormatRenderer.getString("uploadDate", | ||
playerMicroFormatRenderer.getString("publishDate", "")); | ||
if (!dateStr.isEmpty()) { | ||
return dateStr; | ||
} | ||
|
||
final JsonObject liveDetails = playerMicroFormatRenderer.getObject( | ||
"liveBroadcastDetails"); | ||
if (!liveDetails.getString("endTimestamp", "").isEmpty()) { | ||
// an ended live stream | ||
return liveDetails.getString("endTimestamp"); | ||
} else if (!liveDetails.getString("startTimestamp", "").isEmpty()) { | ||
// a running live stream | ||
return liveDetails.getString("startTimestamp"); | ||
final var liveDetails = playerMicroFormatRenderer.getObject("liveBroadcastDetails"); | ||
final String timestamp = liveDetails.getString("endTimestamp", // an ended live stream | ||
liveDetails.getString("startTimestamp", "")); // a running live stream | ||
|
||
if (!timestamp.isEmpty()) { | ||
return timestamp; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this makes it harder to understand what's going on. I'd prefer to keep it readable and revert this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like the code below line 180 as a whole could be removed. I checked how the date is being extracted, and it's always taken from uploadDate
or publishDate
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
YouTube might return different layouts in different cases, so it's better to keep all cases
...in/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeStreamExtractor.java
Outdated
Show resolved
Hide resolved
ddaef9a
to
c79afc0
Compare
Please list all the breaking changes in the PR description so they can be copied to the release notes. |
The tests are now dependent on the runner's time zone, which is not good. While the automated tests pass (server is set to UTC), tests on my computer fail: results
|
Mmmh, what's the advantage of using |
|
0411b8a
to
f38b72c
Compare
Uh oh!
There was an error while loading. Please reload this page.