Skip to content

Commit e638677

Browse files
committed
抖音小视频去水印
1 parent fb50d89 commit e638677

File tree

2 files changed

+12
-41
lines changed

2 files changed

+12
-41
lines changed

springboot-douyin-watermark/pom.xml

Lines changed: 3 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -3,54 +3,16 @@
33
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
44
<modelVersion>4.0.0</modelVersion>
55
<parent>
6-
<groupId>org.springframework.boot</groupId>
7-
<artifactId>spring-boot-starter-parent</artifactId>
8-
<version>2.3.3.RELEASE</version>
9-
<relativePath/> <!-- lookup parent from repository -->
6+
<groupId>com.notebook</groupId>
7+
<artifactId>Springboot-Notebook</artifactId>
8+
<version>0.0.1-SNAPSHOT</version>
109
</parent>
11-
<groupId>com.xiaofu.douyin</groupId>
1210
<artifactId>springboot-douyin-watermark</artifactId>
1311
<version>0.0.1-SNAPSHOT</version>
1412
<name>springboot-douyin-watermark</name>
15-
<description>Demo project for Spring Boot</description>
16-
17-
<properties>
18-
<java.version>1.8</java.version>
19-
</properties>
2013

2114
<dependencies>
2215

23-
<dependency>
24-
<groupId>org.springframework.boot</groupId>
25-
<artifactId>spring-boot-starter-web</artifactId>
26-
</dependency>
27-
28-
<!-- 模板引擎 -->
29-
<dependency>
30-
<groupId>org.springframework.boot</groupId>
31-
<artifactId>spring-boot-starter-thymeleaf</artifactId>
32-
</dependency>
33-
34-
<dependency>
35-
<groupId>com.alibaba</groupId>
36-
<artifactId>fastjson</artifactId>
37-
<version>1.2.49</version>
38-
</dependency>
39-
40-
<dependency>
41-
<groupId>org.projectlombok</groupId>
42-
<artifactId>lombok</artifactId>
43-
<version>1.16.18</version>
44-
<scope>provided</scope>
45-
</dependency>
46-
47-
<!-- 热部署插件 -->
48-
<dependency>
49-
<groupId>org.springframework.boot</groupId>
50-
<artifactId>spring-boot-devtools</artifactId>
51-
<scope>runtime</scope>
52-
</dependency>
53-
5416
</dependencies>
5517

5618
<build>

springboot-douyin-watermark/src/main/java/com/xiaofu/douyin/service/impl/VideoParseUrlServiceImpl.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,17 +85,26 @@ public ResultDto hsParseUrl(String redirectUrl) throws Exception {
8585

8686
if (!StringUtils.isEmpty(redirectUrl)) {
8787

88+
/**
89+
* 1、拿到itemId
90+
*/
8891
String itemId = CommonUtils.hSMatchNo(redirectUrl);
8992

9093
StringBuilder sb = new StringBuilder();
9194
sb.append(CommonUtils.HUO_SHAN_BASE_URL).append(itemId);
9295

96+
/**
97+
* 2、itemId 拼接视频详情接口
98+
*/
9399
String videoResult = CommonUtils.httpGet(sb.toString());
94100

95101
HSResult hsResult = JSON.parseObject(videoResult, HSResult.class);
96102

97103
dyDto.setVideoPic(hsResult.getData().getItem_info().getCover());
98104

105+
/**
106+
* 3、替换URL地址
107+
*/
99108
String replace = hsResult.getData().getItem_info().getUrl().replace("_reflow", "_playback");
100109

101110
dyDto.setVideoUrl(replace.substring(0, replace.indexOf("&")));

0 commit comments

Comments
 (0)