File tree Expand file tree Collapse file tree 4 files changed +10
-19
lines changed
extractor/src/main/java/org/schabi/newpipe/extractor/services/peertube Expand file tree Collapse file tree 4 files changed +10
-19
lines changed Original file line number Diff line number Diff line change 10
10
import org .schabi .newpipe .extractor .Page ;
11
11
import org .schabi .newpipe .extractor .exceptions .ContentNotAvailableException ;
12
12
import org .schabi .newpipe .extractor .exceptions .ParsingException ;
13
+ import org .schabi .newpipe .extractor .localization .DateWrapper ;
13
14
import org .schabi .newpipe .extractor .services .peertube .extractors .PeertubeChannelInfoItemExtractor ;
14
15
import org .schabi .newpipe .extractor .services .peertube .extractors .PeertubePlaylistInfoItemExtractor ;
15
16
import org .schabi .newpipe .extractor .services .peertube .extractors .PeertubeSepiaStreamInfoItemExtractor ;
@@ -46,9 +47,10 @@ public static void validate(final JsonObject json) throws ContentNotAvailableExc
46
47
}
47
48
}
48
49
49
- public static Instant parseInstantFrom (final String textualUploadDate ) throws ParsingException {
50
+ public static DateWrapper parseDateWrapper (final String textualUploadDate )
51
+ throws ParsingException {
50
52
try {
51
- return Instant .parse (textualUploadDate );
53
+ return new DateWrapper ( Instant .parse (textualUploadDate ) );
52
54
} catch (final DateTimeParseException e ) {
53
55
throw new ParsingException ("Could not parse date: \" " + textualUploadDate + "\" " , e );
54
56
}
Original file line number Diff line number Diff line change 23
23
24
24
import static org .schabi .newpipe .extractor .services .peertube .extractors .PeertubeCommentsExtractor .CHILDREN ;
25
25
import 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 ;
27
27
28
28
public class PeertubeCommentsInfoItemExtractor implements CommentsInfoItemExtractor {
29
29
@ Nonnull
@@ -73,7 +73,7 @@ public String getTextualUploadDate() throws ParsingException {
73
73
74
74
@ Override
75
75
public DateWrapper getUploadDate () throws ParsingException {
76
- return new DateWrapper ( parseInstantFrom ( getTextualUploadDate () ));
76
+ return parseDateWrapper ( getTextualUploadDate ());
77
77
}
78
78
79
79
@ Nonnull
Original file line number Diff line number Diff line change 1
1
package org .schabi .newpipe .extractor .services .peertube .extractors ;
2
2
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 .*;
5
4
import static org .schabi .newpipe .extractor .stream .AudioStream .UNKNOWN_BITRATE ;
6
5
import static org .schabi .newpipe .extractor .utils .Utils .isNullOrEmpty ;
7
6
@@ -80,12 +79,7 @@ public String getTextualUploadDate() throws ParsingException {
80
79
@ Override
81
80
public DateWrapper getUploadDate () throws ParsingException {
82
81
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 );
89
83
}
90
84
91
85
@ Nonnull
Original file line number Diff line number Diff line change 14
14
15
15
import static org .schabi .newpipe .extractor .services .peertube .PeertubeParsingHelper .getAvatarsFromOwnerAccountOrVideoChannelObject ;
16
16
import 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 ;
18
18
19
19
public class PeertubeStreamInfoItemExtractor implements StreamInfoItemExtractor {
20
20
@@ -86,12 +86,7 @@ public String getTextualUploadDate() throws ParsingException {
86
86
@ Override
87
87
public DateWrapper getUploadDate () throws ParsingException {
88
88
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 );
95
90
}
96
91
97
92
@ Override
You can’t perform that action at this time.
0 commit comments