|
@@ -36,6 +36,9 @@ public class VideoServiceImpl implements VideoService {
|
|
|
return null;
|
|
|
}
|
|
|
VideoDetail videoDetail = getPQVideoDetail(videoId);
|
|
|
+ if (videoDetail == null) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
videoDetail.setCrawlerVideoId(crawlerVideoId);
|
|
|
videoDetail.setKimiTitle(title);
|
|
|
videoDetail.setUid(uid);
|
|
@@ -46,61 +49,72 @@ public class VideoServiceImpl implements VideoService {
|
|
|
}
|
|
|
|
|
|
private String publishToPQ(String ossPath, String uid, String title) {
|
|
|
- Map<String, Object> payload = new HashMap<>();
|
|
|
- payload.put("deviceToken", "9ef064f2f7869b3fd67d6141f8a899175dddc91240971172f1f2a662ef891408");
|
|
|
- payload.put("fileExtensions", "MP4");
|
|
|
- payload.put("loginUid", uid);
|
|
|
- payload.put("networkType", "Wi-Fi");
|
|
|
- payload.put("platform", "iOS");
|
|
|
- payload.put("requestId", "fb972cbd4f390afcfd3da1869cd7d001");
|
|
|
- payload.put("sessionId", "362290597725ce1fa870d7be4f46dcc2");
|
|
|
- payload.put("subSessionId", "362290597725ce1fa870d7be4f46dcc2");
|
|
|
- payload.put("title", title);
|
|
|
- payload.put("token", "524a8bc871dbb0f4d4717895083172ab37c02d2f");
|
|
|
- payload.put("uid", uid);
|
|
|
- payload.put("versionCode", "486");
|
|
|
- payload.put("versionName", "3.4.12");
|
|
|
- payload.put("videoFromScene", "1");
|
|
|
- payload.put("videoPath", ossPath);
|
|
|
- payload.put("viewStatus", "1");
|
|
|
- payload.put("appType", 888880);
|
|
|
- payload.put("repeatStatus", 1);
|
|
|
+ try {
|
|
|
+ Map<String, Object> payload = new HashMap<>();
|
|
|
+ payload.put("deviceToken", "9ef064f2f7869b3fd67d6141f8a899175dddc91240971172f1f2a662ef891408");
|
|
|
+ payload.put("fileExtensions", "MP4");
|
|
|
+ payload.put("loginUid", uid);
|
|
|
+ payload.put("networkType", "Wi-Fi");
|
|
|
+ payload.put("platform", "iOS");
|
|
|
+ payload.put("requestId", "fb972cbd4f390afcfd3da1869cd7d001");
|
|
|
+ payload.put("sessionId", "362290597725ce1fa870d7be4f46dcc2");
|
|
|
+ payload.put("subSessionId", "362290597725ce1fa870d7be4f46dcc2");
|
|
|
+ payload.put("title", title);
|
|
|
+ payload.put("token", "524a8bc871dbb0f4d4717895083172ab37c02d2f");
|
|
|
+ payload.put("uid", uid);
|
|
|
+ payload.put("versionCode", "486");
|
|
|
+ payload.put("versionName", "3.4.12");
|
|
|
+ payload.put("videoFromScene", "1");
|
|
|
+ payload.put("videoPath", ossPath);
|
|
|
+ payload.put("viewStatus", "1");
|
|
|
+ payload.put("appType", 888880);
|
|
|
+ payload.put("repeatStatus", 1);
|
|
|
|
|
|
- HttpResponse response = HttpRequest.post(PUBLISH_URL)
|
|
|
- .header("User-Agent", "PQSpeed/486 CFNetwork/1410.1 Darwin/22.6.0")
|
|
|
- .header("cookie", "JSESSIONID=4DEA2B5173BB9A9E82DB772C0ACDBC9F; JSESSIONID=D02C334150025222A0B824A98B539B78")
|
|
|
- .header("referer", "http://appspeed.piaoquantv.com")
|
|
|
- .header("accept-language", "zh-CN,zh-Hans;q=0.9")
|
|
|
- .header("Content-Type", "application/x-www-form-urlencoded")
|
|
|
- .form(payload) // 发送表单数据
|
|
|
- .execute();
|
|
|
- String body = response.body();
|
|
|
- JSONObject jsonObject = JSONUtil.parseObj(body);
|
|
|
- return jsonObject.getByPath("data.id", String.class); // 返回响应体
|
|
|
+ HttpResponse response = HttpRequest.post(PUBLISH_URL)
|
|
|
+ .header("User-Agent", "PQSpeed/486 CFNetwork/1410.1 Darwin/22.6.0")
|
|
|
+ .header("cookie", "JSESSIONID=4DEA2B5173BB9A9E82DB772C0ACDBC9F; JSESSIONID=D02C334150025222A0B824A98B539B78")
|
|
|
+ .header("referer", "http://appspeed.piaoquantv.com")
|
|
|
+ .header("accept-language", "zh-CN,zh-Hans;q=0.9")
|
|
|
+ .header("Content-Type", "application/x-www-form-urlencoded")
|
|
|
+ .form(payload) // 发送表单数据
|
|
|
+ .timeout(120000)
|
|
|
+ .execute();
|
|
|
+ String body = response.body();
|
|
|
+ JSONObject jsonObject = JSONUtil.parseObj(body);
|
|
|
+ return jsonObject.getByPath("data.id", String.class); // 返回响应体
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("publishToPQ error", e);
|
|
|
+ }
|
|
|
+ return null;
|
|
|
}
|
|
|
|
|
|
private VideoDetail getPQVideoDetail(String videoId) {
|
|
|
- Map<String, Object> data = new HashMap<>();
|
|
|
- data.put("videoIdList", new String[]{videoId});
|
|
|
+ try {
|
|
|
+ Map<String, Object> data = new HashMap<>();
|
|
|
+ data.put("videoIdList", new String[]{videoId});
|
|
|
|
|
|
- HttpResponse response = HttpRequest.post(VIDEO_DETAIL_URL)
|
|
|
- .header("Content-Type", "application/json")
|
|
|
- .body(JSONUtil.toJsonStr(data)) // 将数据转换为 JSON 字符串
|
|
|
- .execute();
|
|
|
- VideoDetail videoDetail = new VideoDetail();
|
|
|
- JSONObject jsonObject = JSONUtil.parseObj(response.body());
|
|
|
- List<JSONObject> list = jsonObject.get("data", List.class);
|
|
|
- if (!CollectionUtils.isEmpty(data)) {
|
|
|
- String id = list.get(0).getStr("id");
|
|
|
- String shareImgPath = list.get(0).getStr("shareImgPath");
|
|
|
- String videoPath = list.get(0).getStr("videoPath");
|
|
|
- if (StringUtils.isNotEmpty(id)) {
|
|
|
- videoDetail.setVideoId(id);
|
|
|
+ HttpResponse response = HttpRequest.post(VIDEO_DETAIL_URL)
|
|
|
+ .header("Content-Type", "application/json")
|
|
|
+ .body(JSONUtil.toJsonStr(data)) // 将数据转换为 JSON 字符串
|
|
|
+ .execute();
|
|
|
+ VideoDetail videoDetail = new VideoDetail();
|
|
|
+ JSONObject jsonObject = JSONUtil.parseObj(response.body());
|
|
|
+ List<JSONObject> list = jsonObject.get("data", List.class);
|
|
|
+ if (!CollectionUtils.isEmpty(data)) {
|
|
|
+ String id = list.get(0).getStr("id");
|
|
|
+ String shareImgPath = list.get(0).getStr("shareImgPath");
|
|
|
+ String videoPath = list.get(0).getStr("videoPath");
|
|
|
+ if (StringUtils.isNotEmpty(id)) {
|
|
|
+ videoDetail.setVideoId(id);
|
|
|
+ }
|
|
|
+ videoDetail.setVideoCover(shareImgPath);
|
|
|
+ videoDetail.setVideoPath(videoPath);
|
|
|
}
|
|
|
- videoDetail.setVideoCover(shareImgPath);
|
|
|
- videoDetail.setVideoPath(videoPath);
|
|
|
+ return videoDetail;
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("getPQVideoDetail error", e);
|
|
|
}
|
|
|
- return videoDetail;
|
|
|
+ return null;
|
|
|
}
|
|
|
|
|
|
@Override
|