tik集成

This commit is contained in:
wing
2025-10-26 15:56:48 +08:00
parent 2012410215
commit 2ad68890dd
5 changed files with 48 additions and 0 deletions

View File

@@ -46,6 +46,17 @@ public class TikHupController {
return tikHupService.fetch_user_post_videos(type, sec_user_id,max_cursor, count);
}
@PostMapping("/postTikHup")
@Operation(
summary = "获取用户主页作品数据",
description = "通过TikHup API获取指定用户的TikTok作品数据包括视频列表、用户信息等"
)
public Object postTikHup(@RequestParam String type,@RequestParam String methodType,@RequestParam String urlParams) {
return tikHupService.postTikHup(type, methodType,urlParams);
}
@PostMapping("/videoToCharacters")
@Operation(summary = "音频转文字", description = "音频转文字接口")
public Object videoToCharacters(@RequestBody Map<String,Object> fileLinkMap) {

View File

@@ -14,4 +14,7 @@ public class TikTokenVO {
@TableField(value = "platform_token")
private String platformToken;
@TableField(value = "interface_type")
private String interfaceType;
}

View File

@@ -11,4 +11,8 @@ public interface TikTokenMapper extends BaseMapperX<TikTokenVO> {
return selectOne("platform_url",platformUrl);
}
default TikTokenVO getInterfaceUrl(String interfaceType) {
return selectOne("interface_type",interfaceType);
}
}

View File

@@ -16,6 +16,9 @@ public interface TikHupService {
*/
Object fetch_user_post_videos(String type,String sec_user_id,int max_cursor, int count);
Object postTikHup(String type,String methodType,String urlParams);
/**
* 音频转文字
* @param downloadUrl 下载地址

View File

@@ -58,6 +58,33 @@ public class TikHupServiceImpl implements TikHupService{
return new HashMap<>();
}
@Override
public Object postTikHup(String type,String methodType,String urlParams){
TikTokenVO tikTokenVO = tikTokenMapper.getInterfaceUrl(type);
String Authorization = tikTokenVO.getPlatformToken();
String url = tikTokenVO.getPlatformUrl();
try{
Unirest.setTimeouts(0, 0);
HttpResponse<String> response;
if("post".equals(methodType)){
response = Unirest.post(url + "?" + urlParams)
.header("Authorization", "Bearer "+Authorization)
.asString();
} else {
response = Unirest.get(url + "?" + urlParams)
.header("Authorization", "Bearer "+Authorization)
.asString();
}
if(response.getStatus() == 200){
Long userId = SecurityFrameworkUtils.getLoginUser().getId();
return JSON.parseObject(response.getBody());
}
}catch (Exception e){
log.error("{}接口调用异常",url);
}
return new HashMap<>();
}
private final String appKey = "sldJ4XSpYp3rKALZ ";
private final String accessKeyId = "LTAI5tPV9Ag3csf41GZjaLTA";
private final String accessKeySecret = "kDqlGeJTKw6tJtFYiaY8vQTFuVIQDs";