|
@@ -15,6 +15,7 @@ import com.tzld.piaoquan.longarticle.utils.LarkRobotUtil;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.data.redis.core.RedisTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
@@ -23,6 +24,8 @@ import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.Objects;
|
|
|
|
|
|
+import static com.tzld.piaoquan.longarticle.common.constants.RedisConstant.REDIS_COOKIE_KEY;
|
|
|
+
|
|
|
@Slf4j
|
|
|
@Service
|
|
|
public class VideoServiceImpl implements VideoService {
|
|
@@ -34,6 +37,11 @@ public class VideoServiceImpl implements VideoService {
|
|
|
@Autowired
|
|
|
private OffVideoMapper offVideoMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private RedisTemplate<String, Object> redisTemplate;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
public VideoDetail publish(String ossPath, String uid, String title) {
|
|
|
String videoId = publishToPQ(ossPath, uid, title);
|
|
|
if (videoId == null) {
|
|
@@ -44,6 +52,10 @@ public class VideoServiceImpl implements VideoService {
|
|
|
|
|
|
private String publishToPQ(String ossPath, String uid, String title) {
|
|
|
try {
|
|
|
+ String cookie = (String) redisTemplate.opsForValue().get(REDIS_COOKIE_KEY);
|
|
|
+ if(StringUtils.isEmpty(cookie)){
|
|
|
+ cookie = "JSESSIONID=4DEA2B5173BB9A9E82DB772C0ACDBC9F; JSESSIONID=D02C334150025222A0B824A98B539B78";
|
|
|
+ }
|
|
|
Map<String, Object> payload = new HashMap<>();
|
|
|
payload.put("deviceToken", "9ef064f2f7869b3fd67d6141f8a899175dddc91240971172f1f2a662ef891408");
|
|
|
payload.put("fileExtensions", "MP4");
|
|
@@ -66,7 +78,7 @@ public class VideoServiceImpl implements VideoService {
|
|
|
|
|
|
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("cookie", cookie)
|
|
|
.header("referer", "http://appspeed.piaoquantv.com")
|
|
|
.header("accept-language", "zh-CN,zh-Hans;q=0.9")
|
|
|
.header("Content-Type", "application/x-www-form-urlencoded")
|