diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeStreamExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeStreamExtractor.java index 2408b5c02c..b5d03edcce 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeStreamExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeStreamExtractor.java @@ -134,7 +134,13 @@ public String getTextualUploadDate() throws ParsingException { } try { - // return playerResponse.getObject("microformat").getObject("playerMicroformatRenderer").getString("publishDate"); + JsonObject micro = playerResponse.getObject("microformat").getObject("playerMicroformatRenderer"); + if (micro.getString("uploadDate") != null && !micro.getString("uploadDate").isEmpty()) { + return micro.getString("uploadDate"); + } + if (micro.getString("publishDate") != null && !micro.getString("publishDate").isEmpty()) { + return micro.getString("publishDate"); + } } catch (Exception ignored) {} try { @@ -147,7 +153,7 @@ public String getTextualUploadDate() throws ParsingException { return new SimpleDateFormat("yyyy-MM-dd").format(parsedTime.getTime()); } catch (Exception ignored) {} - try { // Premiered Premiered Feb 21, 2020 + try { // Premiered Feb 21, 2020 Date d = new SimpleDateFormat("MMM dd, YYYY", Locale.ENGLISH).parse(time); return new SimpleDateFormat("yyyy-MM-dd").format(d.getTime()); } catch (Exception ignored) {}