Exemplo n.º 1
0
  public static void submitToYtdDomain(
      String ytdDomain,
      String assignmentId,
      String videoId,
      String youTubeName,
      String clientLoginToken,
      String title,
      String description,
      Date dateTaken,
      String videoLocation,
      String tags) {
    JSONObject payload = new JSONObject();
    try {
      payload.put("method", "NEW_MOBILE_VIDEO_SUBMISSION");
      JSONObject params = new JSONObject();

      params.put("videoId", videoId);
      params.put("youTubeName", youTubeName);
      params.put("clientLoginToken", clientLoginToken);
      params.put("title", title);
      params.put("description", description);
      params.put("videoDate", dateTaken.toString());
      params.put("tags", tags);

      if (videoLocation != null) {
        params.put("videoLocation", videoLocation);
      }

      if (assignmentId != null) {
        params.put("assignmentId", assignmentId);
      }

      payload.put("params", params);
    } catch (JSONException e) {
      e.printStackTrace();
    }

    String jsonRpcUrl = "http://" + ytdDomain + "/jsonrpc";
    String json = VideoUtil.makeJsonRpcCall(jsonRpcUrl, payload);

    Log.i("JSON-Upload", payload.toString());

    if (json != null) {
      try {
        JSONObject jsonObj = new JSONObject(json);
      } catch (JSONException e) {
        e.printStackTrace();
      }
    }
  }
Exemplo n.º 2
0
 @Test
 public void testGetVideoViewCount() {
   String actualViewCount = VideoUtil.getVideoViewCount("o4_1hS1aIC8");
   assertNotNull(actualViewCount);
 }