Skip to content

Instantly share code, notes, and snippets.

@PatrickKalkman
Created January 24, 2022 15:42
Show Gist options
  • Save PatrickKalkman/3a353aa9e2bac65d30cd2c21fa395e44 to your computer and use it in GitHub Desktop.
Save PatrickKalkman/3a353aa9e2bac65d30cd2c21fa395e44 to your computer and use it in GitHub Desktop.
public List<ContentValues> parseMedia(JSONArray videoArray) throws JSONException {
List<ContentValues> videosToInsert = new ArrayList<>();
for (int j = 0; j < videoArray.length(); j++) {
JSONObject video = videoArray.getJSONObject(j);
String videoUrl = video.optString(TAG_URL);
String titleId = video.optString(TAG_TITLE_ID);
if (videoUrl.isEmpty()) {
if (!titleId.isEmpty()) {
videoUrl = titleId;
} else {
videoUrl = video.optString("_id");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment