File tree Expand file tree Collapse file tree
extractor/src/main/java/org/schabi/newpipe/extractor/services/peertube Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1010import org .schabi .newpipe .extractor .Page ;
1111import org .schabi .newpipe .extractor .exceptions .ContentNotAvailableException ;
1212import org .schabi .newpipe .extractor .exceptions .ParsingException ;
13+ import org .schabi .newpipe .extractor .localization .DateWrapper ;
1314import org .schabi .newpipe .extractor .services .peertube .extractors .PeertubeChannelInfoItemExtractor ;
1415import org .schabi .newpipe .extractor .services .peertube .extractors .PeertubePlaylistInfoItemExtractor ;
1516import org .schabi .newpipe .extractor .services .peertube .extractors .PeertubeSepiaStreamInfoItemExtractor ;
@@ -46,9 +47,10 @@ public static void validate(final JsonObject json) throws ContentNotAvailableExc
4647 }
4748 }
4849
49- public static Instant parseInstantFrom (final String textualUploadDate ) throws ParsingException {
50+ public static DateWrapper parseDateWrapper (final String textualUploadDate )
51+ throws ParsingException {
5052 try {
51- return Instant .parse (textualUploadDate );
53+ return new DateWrapper ( Instant .parse (textualUploadDate ) );
5254 } catch (final DateTimeParseException e ) {
5355 throw new ParsingException ("Could not parse date: \" " + textualUploadDate + "\" " , e );
5456 }
Original file line number Diff line number Diff line change 2323
2424import static org .schabi .newpipe .extractor .services .peertube .extractors .PeertubeCommentsExtractor .CHILDREN ;
2525import static org .schabi .newpipe .extractor .services .peertube .PeertubeParsingHelper .getAvatarsFromOwnerAccountOrVideoChannelObject ;
26- import static org .schabi .newpipe .extractor .services .peertube .PeertubeParsingHelper .parseInstantFrom ;
26+ import static org .schabi .newpipe .extractor .services .peertube .PeertubeParsingHelper .parseDateWrapper ;
2727
2828public class PeertubeCommentsInfoItemExtractor implements CommentsInfoItemExtractor {
2929 @ Nonnull
@@ -73,7 +73,7 @@ public String getTextualUploadDate() throws ParsingException {
7373
7474 @ Override
7575 public DateWrapper getUploadDate () throws ParsingException {
76- return new DateWrapper ( parseInstantFrom ( getTextualUploadDate () ));
76+ return parseDateWrapper ( getTextualUploadDate ());
7777 }
7878
7979 @ Nonnull
Original file line number Diff line number Diff line change 11package org .schabi .newpipe .extractor .services .peertube .extractors ;
22
3- import static org .schabi .newpipe .extractor .services .peertube .PeertubeParsingHelper .getAvatarsFromOwnerAccountOrVideoChannelObject ;
4- import static org .schabi .newpipe .extractor .services .peertube .PeertubeParsingHelper .getThumbnailsFromPlaylistOrVideoItem ;
3+ import static org .schabi .newpipe .extractor .services .peertube .PeertubeParsingHelper .*;
54import static org .schabi .newpipe .extractor .stream .AudioStream .UNKNOWN_BITRATE ;
65import static org .schabi .newpipe .extractor .utils .Utils .isNullOrEmpty ;
76
@@ -80,12 +79,7 @@ public String getTextualUploadDate() throws ParsingException {
8079 @ Override
8180 public DateWrapper getUploadDate () throws ParsingException {
8281 final String textualUploadDate = getTextualUploadDate ();
83-
84- if (textualUploadDate == null ) {
85- return null ;
86- }
87-
88- return new DateWrapper (PeertubeParsingHelper .parseInstantFrom (textualUploadDate ));
82+ return textualUploadDate == null ? null : parseDateWrapper (textualUploadDate );
8983 }
9084
9185 @ Nonnull
Original file line number Diff line number Diff line change 1414
1515import static org .schabi .newpipe .extractor .services .peertube .PeertubeParsingHelper .getAvatarsFromOwnerAccountOrVideoChannelObject ;
1616import static org .schabi .newpipe .extractor .services .peertube .PeertubeParsingHelper .getThumbnailsFromPlaylistOrVideoItem ;
17- import static org .schabi .newpipe .extractor .services .peertube .PeertubeParsingHelper .parseInstantFrom ;
17+ import static org .schabi .newpipe .extractor .services .peertube .PeertubeParsingHelper .parseDateWrapper ;
1818
1919public class PeertubeStreamInfoItemExtractor implements StreamInfoItemExtractor {
2020
@@ -86,12 +86,7 @@ public String getTextualUploadDate() throws ParsingException {
8686 @ Override
8787 public DateWrapper getUploadDate () throws ParsingException {
8888 final String textualUploadDate = getTextualUploadDate ();
89-
90- if (textualUploadDate == null ) {
91- return null ;
92- }
93-
94- return new DateWrapper (parseInstantFrom (textualUploadDate ));
89+ return textualUploadDate == null ? null : parseDateWrapper (textualUploadDate );
9590 }
9691
9792 @ Override
You can’t perform that action at this time.
0 commit comments