address reviews
This commit is contained in:
parent
c47cc54908
commit
8806fb4e6b
|
@ -103,14 +103,14 @@ public class Localization implements Serializable {
|
|||
|
||||
/**
|
||||
* Converts a three letter language code (ISO 639-2/T) to a Locale
|
||||
* in the limit of Java Locale class.
|
||||
* because limits of Java Locale class.
|
||||
*
|
||||
* @param code a three letter language code
|
||||
* @return the Locale corresponding
|
||||
*/
|
||||
public static Locale getLocaleFromThreeLetterCode(@Nonnull String code) throws ParsingException {
|
||||
String[] languages = Locale.getISOLanguages();
|
||||
Map<String, Locale> localeMap = new HashMap<>(languages.length);
|
||||
final String[] languages = Locale.getISOLanguages();
|
||||
final Map<String, Locale> localeMap = new HashMap<>(languages.length);
|
||||
for (String language : languages) {
|
||||
final Locale locale = new Locale(language);
|
||||
localeMap.put(locale.getISO3Language(), locale);
|
||||
|
|
|
@ -435,7 +435,7 @@ public class PeertubeStreamExtractor extends StreamExtractor {
|
|||
case 4:
|
||||
return Privacy.INTERNAL;
|
||||
default:
|
||||
return null;
|
||||
return Privacy.OTHER;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1109,7 +1109,7 @@ public class YoutubeStreamExtractor extends StreamExtractor {
|
|||
@Nonnull
|
||||
@Override
|
||||
public Privacy getPrivacy() {
|
||||
boolean isUnlisted = playerResponse
|
||||
final boolean isUnlisted = playerResponse
|
||||
.getObject("microformat")
|
||||
.getObject("playerMicroformatRenderer")
|
||||
.getBoolean("isUnlisted");
|
||||
|
|
|
@ -513,6 +513,7 @@ public abstract class StreamExtractor extends Extractor {
|
|||
PUBLIC,
|
||||
UNLISTED,
|
||||
PRIVATE,
|
||||
INTERNAL
|
||||
INTERNAL,
|
||||
OTHER
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,52 +50,19 @@ public class MediaCCCStreamExtractorTest {
|
|||
@Override public List<String> expectedDescriptionContains() { return Arrays.asList("SSH-Sessions", "\"Terminal Multiplexer\""); }
|
||||
@Override public long expectedLength() { return 3097; }
|
||||
@Override public long expectedViewCountAtLeast() { return 2380; }
|
||||
@Nullable
|
||||
@Override public String expectedUploadDate() { return "2018-05-11 00:00:00.000"; }
|
||||
@Nullable
|
||||
@Override
|
||||
public String expectedTextualUploadDate() {
|
||||
return "2018-05-11T02:00:00.000+02:00";
|
||||
}
|
||||
@Nullable @Override public String expectedUploadDate() { return "2018-05-11 00:00:00.000"; }
|
||||
@Nullable @Override public String expectedTextualUploadDate() { return "2018-05-11T02:00:00.000+02:00"; }
|
||||
@Override public long expectedLikeCountAtLeast() { return -1; }
|
||||
@Override public long expectedDislikeCountAtLeast() { return -1; }
|
||||
@Override public boolean expectedHasRelatedStreams() { return false; }
|
||||
@Override public boolean expectedHasSubtitles() { return false; }
|
||||
@Override public boolean expectedHasFrames() { return false; }
|
||||
@Override public List<String> expectedTags() { return Arrays.asList("gpn18", "105"); }
|
||||
@Override public int expectedStreamSegmentsCount() { return 0; }
|
||||
@Override public Locale expectedLanguageInfo() { return new Locale("de"); }
|
||||
|
||||
@Override
|
||||
public long expectedLikeCountAtLeast() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long expectedDislikeCountAtLeast() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean expectedHasRelatedStreams() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean expectedHasSubtitles() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean expectedHasFrames() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> expectedTags() {
|
||||
return Arrays.asList("gpn18", "105");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int expectedStreamSegmentsCount() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Test
|
||||
public void testThumbnailUrl() throws Exception {
|
||||
@Test public void testThumbnailUrl() throws Exception {
|
||||
super.testThumbnailUrl();
|
||||
assertEquals("https://static.media.ccc.de/media/events/gpn/gpn18/105-hd.jpg", extractor.getThumbnailUrl());
|
||||
}
|
||||
|
@ -120,11 +87,6 @@ public class MediaCCCStreamExtractorTest {
|
|||
super.testAudioStreams();
|
||||
assertEquals(2, extractor.getAudioStreams().size());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Locale expectedLanguageInfo() {
|
||||
return new Locale("de");
|
||||
}
|
||||
}
|
||||
|
||||
public static class _36c3PrivacyMessaging extends DefaultStreamExtractorTest {
|
||||
|
@ -139,111 +101,37 @@ public class MediaCCCStreamExtractorTest {
|
|||
extractor.fetchPage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public StreamExtractor extractor() {
|
||||
@Override public StreamExtractor extractor() {
|
||||
return extractor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StreamingService expectedService() {
|
||||
@Override public StreamingService expectedService() {
|
||||
return MediaCCC;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String expectedName() {
|
||||
@Override public String expectedName() {
|
||||
return "What's left for private messaging?";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String expectedId() {
|
||||
@Override public String expectedId() {
|
||||
return ID;
|
||||
}
|
||||
@Override public String expectedUrlContains() { return URL; }
|
||||
@Override public String expectedOriginalUrlContains() { return URL; }
|
||||
@Override public StreamType expectedStreamType() { return StreamType.VIDEO_STREAM; }
|
||||
@Override public String expectedUploaderName() { return "36c3"; }
|
||||
@Override public String expectedUploaderUrl() { return "https://media.ccc.de/c/36c3"; }
|
||||
@Override public List<String> expectedDescriptionContains() { return Arrays.asList("WhatsApp", "Signal"); }
|
||||
@Override public long expectedLength() { return 3603; }
|
||||
@Override public long expectedViewCountAtLeast() { return 2380; }
|
||||
@Nullable @Override public String expectedUploadDate() { return "2020-01-11 00:00:00.000"; }
|
||||
@Nullable @Override public String expectedTextualUploadDate() { return "2020-01-11T01:00:00.000+01:00"; }
|
||||
@Override public long expectedLikeCountAtLeast() { return -1; }
|
||||
@Override public long expectedDislikeCountAtLeast() { return -1; }
|
||||
@Override public boolean expectedHasRelatedStreams() { return false; }
|
||||
@Override public boolean expectedHasSubtitles() { return false; }
|
||||
@Override public boolean expectedHasFrames() { return false; }
|
||||
@Override public List<String> expectedTags() { return Arrays.asList("36c3", "10565", "2019", "Security", "Main"); }
|
||||
|
||||
@Override
|
||||
public String expectedUrlContains() {
|
||||
return URL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String expectedOriginalUrlContains() {
|
||||
return URL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StreamType expectedStreamType() {
|
||||
return StreamType.VIDEO_STREAM;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String expectedUploaderName() {
|
||||
return "36c3";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String expectedUploaderUrl() {
|
||||
return "https://media.ccc.de/c/36c3";
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> expectedDescriptionContains() {
|
||||
return Arrays.asList("WhatsApp", "Signal");
|
||||
}
|
||||
|
||||
@Override
|
||||
public long expectedLength() {
|
||||
return 3603;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long expectedViewCountAtLeast() {
|
||||
return 2380;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public String expectedUploadDate() {
|
||||
return "2020-01-11 00:00:00.000";
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public String expectedTextualUploadDate() {
|
||||
return "2020-01-11T01:00:00.000+01:00";
|
||||
}
|
||||
|
||||
@Override
|
||||
public long expectedLikeCountAtLeast() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long expectedDislikeCountAtLeast() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean expectedHasRelatedStreams() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean expectedHasSubtitles() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean expectedHasFrames() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> expectedTags() {
|
||||
return Arrays.asList("36c3", "10565", "2019", "Security", "Main");
|
||||
}
|
||||
|
||||
@Override
|
||||
@Test
|
||||
public void testThumbnailUrl() throws Exception {
|
||||
@Test public void testThumbnailUrl() throws Exception {
|
||||
super.testThumbnailUrl();
|
||||
assertEquals("https://static.media.ccc.de/media/congress/2019/10565-hd.jpg", extractor.getThumbnailUrl());
|
||||
}
|
||||
|
|
|
@ -432,7 +432,6 @@ public class YoutubeStreamExtractorDefaultTest {
|
|||
}
|
||||
|
||||
public static class CCLicensed {
|
||||
// StreamSegment example with macro-makers panel and transcription panel
|
||||
private static final String ID = "M4gD1WSo5mA";
|
||||
private static final String URL = BASE_URL + ID;
|
||||
private static StreamExtractor extractor;
|
||||
|
|
Loading…
Reference in New Issue