Skip to content

Commit 672f100

Browse files
committed
1. 动态UA
1 parent 5af402c commit 672f100

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

parser/src/main/java/cn/qaiu/entity/ShareLinkInfo.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,11 @@ public void setStandardUrl(String standardUrl) {
7777

7878
public String getCacheKey() {
7979
// 将type和shareKey组合成一个字符串作为缓存key
80-
return type + ":" + shareKey;
80+
String key = type + ":" + shareKey;
81+
if (type.equals("p115")) {
82+
key += ("_" + otherParam.get("UA").toString().hashCode());
83+
}
84+
return key;
8185
}
8286

8387
public ShareLinkInfo setOtherParam(Map<String, Object> otherParam) {

web-service/src/main/java/cn/qaiu/lz/web/controller/ParserApi.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ public Future<LinkInfoResp> parse(HttpServerRequest request, String pwd) {
5959
.apiLink(getDownLink(parserCreate, true))
6060
.shareLinkInfo(shareLinkInfo).build();
6161
// 解析次数统计
62+
shareLinkInfo.getOtherParam().put("UA",request.headers().get("user-agent"));
6263
cacheManager.getShareKeyTotal(shareLinkInfo.getCacheKey()).onSuccess(res -> {
6364
if (res != null) {
6465
build.setCacheHitTotal(res.get("hit_total") == null ? 0: res.get("hit_total"));

web-service/src/main/resources/app-dev.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ cache:
6363
mne: 30
6464
mqq: 30
6565
mkg: 30
66+
p115: 5
6667

6768
# httpClient静态代理服务器配置(外网代理)
6869
proxy:

0 commit comments

Comments
 (0)