-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sender korrekturen und ARD Anpassungen
- Loading branch information
Showing
14 changed files
with
311 additions
and
139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 12 additions & 13 deletions
25
src/main/java/mServer/crawler/sender/ard/json/ArdDayPageDeserializer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,34 @@ | ||
package mServer.crawler.sender.ard.json; | ||
|
||
import com.google.gson.JsonArray; | ||
import com.google.gson.JsonDeserializationContext; | ||
import com.google.gson.JsonDeserializer; | ||
import com.google.gson.JsonElement; | ||
import com.google.gson.JsonObject; | ||
import com.google.gson.*; | ||
|
||
import mServer.crawler.sender.ard.ArdFilmInfoDto; | ||
|
||
import java.lang.reflect.Type; | ||
import java.util.HashSet; | ||
import java.util.Set; | ||
import mServer.crawler.sender.ard.ArdFilmInfoDto; | ||
|
||
public class ArdDayPageDeserializer extends ArdTeasersDeserializer implements JsonDeserializer<Set<ArdFilmInfoDto>> { | ||
public class ArdDayPageDeserializer extends ArdTeasersDeserializer | ||
implements JsonDeserializer<Set<ArdFilmInfoDto>> { | ||
|
||
private static final String ELEMENT_TEASERS = "teasers"; | ||
|
||
@Override | ||
public Set<ArdFilmInfoDto> deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext context) { | ||
Set<ArdFilmInfoDto> results = new HashSet<>(); | ||
public Set<ArdFilmInfoDto> deserialize( | ||
final JsonElement jsonElement, final Type type, final JsonDeserializationContext context) { | ||
final Set<ArdFilmInfoDto> results = new HashSet<>(); | ||
|
||
if (!jsonElement.isJsonArray()) { | ||
return results; | ||
} | ||
|
||
JsonObject element0 = jsonElement.getAsJsonArray().get(0).getAsJsonObject(); | ||
final JsonObject firstElement = jsonElement.getAsJsonArray().get(0).getAsJsonObject(); | ||
|
||
if (element0.has(ELEMENT_TEASERS)) { | ||
JsonArray teasers = element0.get(ELEMENT_TEASERS).getAsJsonArray(); | ||
if (firstElement.has(ELEMENT_TEASERS)) { | ||
final JsonArray teasers = firstElement.get(ELEMENT_TEASERS).getAsJsonArray(); | ||
results.addAll(parseTeasers(teasers)); | ||
} | ||
|
||
return results; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.