怒爬某破Hub站资源,只为撸这个鉴黄平台!
程序员私房菜
共 3180字,需浏览 7分钟
· 2020-09-01
# 数据准备
# 账号准备
1、使用如下链接注册账号
2、创建 UAI-Censor 应用
3、获取公钥、私钥,应用ID
https://console.ucloud.cn/uapi/apikey
点击显示即可查看公钥私钥了
4、编码
实在不忍直视啊,我就打码了,不过看到 forbid了吗
/**
* @param imageUrl
* @return pass-放行, forbid-封禁, check-人工审核
* @throws Exception
*/
public String check(String imageUrl) {
String ucloudUrl = "http://api.uai.ucloud.cn/v1/image/scan";
String appId = "uaicensor-rjmvogpx";
String uaicensorPublicKey = null;
String uaicensorPrivateKey = null;
//图片绝对路径
RestTemplate rest = new RestTemplate();
HttpHeaders headers = new HttpHeaders();
/**
* 生成signature,首字母排序
*/
String timestamp = System.currentTimeMillis() + "";
SortedMap<Object, Object> packageParams = new TreeMap<>();
packageParams.put("PublicKey", uaicensorPublicKey);
packageParams.put("ResourceId", appId);
packageParams.put("Timestamp", timestamp);
packageParams.put("Url", imageUrl);
String signature = null;
try {
signature = UCloudUtil.createSign(packageParams, uaicensorPrivateKey);
} catch (Exception e) {
return null;
}
/**
* 参数
*/
MultiValueMap<String, Object> param = new LinkedMultiValueMap<>();
param.add("Scenes", "porn");
param.add("Method", "url");
param.add("Url", imageUrl);
/**
* headers 参数
*/
headers.setContentType(MediaType.parseMediaType("multipart/form-data; charset=UTF-8"));
headers.set("PublicKey", uaicensorPublicKey);
headers.set("Signature", signature);
headers.set("ResourceId", appId);
headers.set("Timestamp", timestamp);
HttpEntity
String , Object>> httpEntity = new HttpEntity<>(param, headers);ResponseEntity<String> responseEntity = rest.exchange(ucloudUrl, HttpMethod.POST, httpEntity, String.class);
String body = responseEntity.getBody();
JSONObject jsonObject = JSON.parseObject(body);
if (jsonObject.getInteger("RetCode") == 0) {
String res = jsonObject.getJSONObject("Result").getJSONObject("Porn").getString("Suggestion");
return res;
}
return null;
}
最后免费给大家分享50个Java项目实战资料,涵盖入门、进阶各个阶段学习内容,可以说非常全面了。大部分视频还附带源码,学起来还不费劲!
附上截图。(下面有下载方式)。
项目领取方式:
扫描下方公众号回复:50,
可获取下载链接
???
?长按上方二维码 2 秒 回复「50」即可获取资料
点赞是最大的支持
评论
西瓜播放器HTML5 视频播放器
西瓜播放器是一个Web视频播放器类库,它本着一切都是组件化的原则设计了独立可拆卸的UI组件。更重要的是它不只是在UI层有灵活的表现,在功能上也做了大胆的尝试:摆脱视频加载、缓冲、格式支持对video的
西瓜播放器HTML5 视频播放器
0
PKplayerP2P 播放器
PKplayer是一个P2P播放器,支持Android、iOS平台。基于ijkplayer,ppeasy开发,P2P方式播放rtmp直播源,观众越多,播放越流畅。网络通信(内网穿透)的模块,使用ppe
PKplayerP2P 播放器
0
RockboxMP3播放器
Rockbox是一个功能非常强大的嵌入式MP3播放器,目前运行Rockbox进行MP3播放的设备包括:Apple:1stthrough5.5thgenerationiPod,iPodMiniand1s
RockboxMP3播放器
0