国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

Table of Contents
## Practice it personally" >## Practice it personally
Home Java JavaBase Java programmers hand-write a Douyin video watermark removal tool

Java programmers hand-write a Douyin video watermark removal tool

Nov 27, 2020 pm 05:02 PM
java Remove watermark

java Basics introduces the method of removing watermark tools.

Java programmers hand-write a Douyin video watermark removal tool

Related learning recommendations: java basics

百cause有愿

Let me tell you why I want to make a Douyin video watermark removal tool. It’s actually because of my silly girlfriend. She actually fucked me~

One night she was in Douyin saw a very educational video, "If a man loves his wife, he should do all the housework", and then he wanted to download the video and share it with her sisters group to communicate 元夫 Thoughts.

But everyone knows that the videos downloaded from Douyin are watermarked. As a player with severe obsessive-compulsive disorder, this is not allowed. If there is no way, then look for a watermark removal tool. I searched around and found one. Either it is charging or it cannot be downloaded, and the smile on the master's face is gradually disappearing.

I joked on the side: It’s not that difficult, how about I make one for you! "Are you okay?" Then he cast a disdainful look.

Java programmers hand-write a Douyin video watermark removal tool

oops! It was just a joke, but you actually said that I am not good. This is unbearable. I have to prove it to you! Men, I just can’t stand this.

Let’s take a look at the online preview of the watermark removal tool I made: 47.93.6.5:8888/index

Java programmers hand-write a Douyin video watermark removal tool

Let’s analyze the idea of ????making this watermark removal tool with everyone. When many people hear watermark removal at first glance, they subconsciously think that it is an awesome algorithm. In fact, it is an algorithm. It’s an illusion~

Go to the bottom of things

Although I have to argue, I was really confused when I first started doing it because I didn’t know where to start. What is the principle behind watermark removal? Is it possible that I still need to write an algorithm?

I found a sharing link for a Douyin video. After a little analysis, it was not difficult to find that this is a processed short link. Then this short link will definitely redirect to the real video addressURL .

https://v.douyin.com/JSkuhE4/

Enter the short link in the browser and get the following URL. Based on my experience, I judge that the 6820792802394262795 in URL is very likely to be The unique ID of the video, and the unique ID is usually used as an input parameter for the interface to obtain details. Hehe~ I seem to have a clue.

https://www.iesdouyin.com/share/video/6820792802394262795/

Java programmers hand-write a Douyin video watermark removal tool

hurry up F12 Dafa opened the console and found such an interface among many requests. It actually used the unique ID above.

https://www.iesdouyin.com/web/api/v2/aweme/iteminfo/?item_ids=6820792802394262795


What’s even more surprising is that the data returned by the interface is so detailed, including author information, audio address, video address, and floor plan. But there is no video URL without watermark.

Only found one video with watermark URL, I was a little disappointed. I looked at the address again and found that wm was a bit similar to the name of my project. Ah, isn't it the abbreviation of watermark?

https://aweme.snssdk.com/aweme/v1/playwm/?video_id=v0200f030000bqk54kg2saj3lso3oh20&ratio=720p&line=0


As if I saw a glimmer of hope again, I quickly modified URL and tried it again in the browser, and sure enough, there was no watermark.

https://aweme.snssdk.com/aweme/v1/play/?video_id=v0200f030000bqk54kg2saj3lso3oh20&ratio=720p&line=0

Java programmers hand-write a Douyin video watermark removal tool
Only then did I discover DouyinRemove the watermark It’s so simple that it’s touching, hahaha~

Now that the principles are clear, all that's left is to implement the function step by step. The principle seems quite simple, but there are still some pitfalls in the implementation, which wastes a lot of time.

The implementation process has only three simple steps:

    1. Filter out the short video link from the input box
  • 2. Pass the short link to the backend and parse it out Video without watermark
  • URL
  • 3. Video
  • URL is passed to the front-end for preview and download
. It is not difficult for the back-end in one step. Just follow the analysis process above to parse the real video

URL in one step.

注意 :我們想得到的地址URL,都是當(dāng)前短連接URL 經(jīng)過(guò)重定向后的URL。而抖音有些鏈接是不支持瀏覽器訪(fǎng)問(wèn)的,所以要手動(dòng)修改 User-agent 屬性模擬移動(dòng)端訪(fǎng)問(wèn)才可以。

/**
*?@param?url
*?@author?xiaofu
*?@description?獲取當(dāng)前鏈接重定向后的url
*?@date?2020/9/15?12:43
*/public?static?String?getLocation(String?url)?{
????????try?{
????????????URL?serverUrl?=?new?URL(url);
????????????HttpURLConnection?conn?=?(HttpURLConnection)?serverUrl.openConnection();
????????????conn.setRequestMethod("GET");
????????????conn.setInstanceFollowRedirects(false);
????????????conn.setRequestProperty("User-agent",?"ua");//模擬手機(jī)連接
????????????conn.connect();
????????????String?location?=?conn.getHeaderField("Location");
????????????return?location;
????????}?catch?(Exception?e)?{
????????????e.printStackTrace();
????????}
????????return?"";
????}

下邊是完整的后端實(shí)現(xiàn),可以看到代碼量非常的少。

/**
?*?@author?xiaofu-公眾號(hào):程序員內(nèi)點(diǎn)事
?*?@description?抖音無(wú)水印視頻下載
?*?@date?2020/9/15?18:44
?*/@Slf4j
@Controllerpublic?class?DYController?{
????public?static?String?DOU_YIN_BASE_URL?=?"https://www.iesdouyin.com/web/api/v2/aweme/iteminfo/?item_ids=";
????/**
?????*?@param?url
?????*?@author?xiaofu
?????*?@description?解析抖音無(wú)水印視頻
?????*?@date?2020/9/15?12:43
?????*/
????@RequestMapping("/parseVideoUrl")
????@ResponseBody????public?String?parseVideoUrl(@RequestBody?String?url)?throws?Exception?{
????????DYDto?dyDto?=?new?DYDto();
????????try?{
????????????url?=?URLDecoder.decode(url).replace("url=",?"");
????????????/**
?????????????*?1、短連接重定向后的?URL
?????????????*/
????????????String?redirectUrl?=?CommonUtils.getLocation(url);

????????????/**
?????????????*?2、拿到視頻對(duì)應(yīng)的?ItemId
?????????????*/
????????????String?videoUrl?=?"";
????????????String?musicUrl?=?"";
????????????String?videoPic?=?"";
????????????String?desc?=?"";
????????????if?(!StringUtils.isEmpty(redirectUrl))?{
????????????????/**
?????????????????*?3、用?ItemId?拿視頻的詳細(xì)信息,包括無(wú)水印視頻url
?????????????????*/
????????????????String?itemId?=?CommonUtils.matchNo(redirectUrl);
????????????????StringBuilder?sb?=?new?StringBuilder();
????????????????sb.append(DOU_YIN_BASE_URL).append(itemId);
????????????????String?videoResult?=?CommonUtils.httpGet(sb.toString());
????????????????DYResult?dyResult?=?JSON.parseObject(videoResult,?DYResult.class);
????????????????/**
?????????????????*?4、無(wú)水印視頻?url
?????????????????*/
????????????????videoUrl?=?dyResult.getItem_list().get(0)
????????????????????????.getVideo().getPlay_addr().getUrl_list().get(0)
????????????????????????.replace("playwm",?"play");
????????????????String?videoRedirectUrl?=?CommonUtils.getLocation(videoUrl);
????????????????dyDto.setVideoUrl(videoRedirectUrl);
????????????????/**
?????????????????*?5、音頻?url
?????????????????*/
????????????????musicUrl?=?dyResult.getItem_list().get(0).getMusic().getPlay_url().getUri();
????????????????dyDto.setMusicUrl(musicUrl);
????????????????/**
?????????????????*?6、封面
?????????????????*/
????????????????videoPic?=?dyResult.getItem_list().get(0).getVideo().getDynamic_cover().getUrl_list().get(0);
????????????????dyDto.setVideoPic(videoPic);
????????????????/**
?????????????????*?7、視頻文案
?????????????????*/
????????????????desc?=?dyResult.getItem_list().get(0).getDesc();
????????????????dyDto.setDesc(desc);
????????????}
????????}?catch?(Exception?e)?{
????????????log.error("去水印異常?{}",?e);
????????}
????????return?JSON.toJSONString(dyDto);
????}}

前端實(shí)現(xiàn)也比較簡(jiǎn)單,拿到后端解析出來(lái)的視頻URL 預(yù)覽播放、下載就OK了。

Java programmers hand-write a Douyin video watermark removal tool

為快速實(shí)現(xiàn)我用了老古董JQuery,我這個(gè)年紀(jì)的人對(duì)它感情還是很深厚的,UI 框架用的 layer.js。源碼后邊會(huì)分享給大家,就不全貼出來(lái)了。

$.ajax({
????url:?'/parseVideoUrl',
????type:?'POST',
????data:?{"url":?link},
????success:?function?(data)?{
????????$('.qsy-submit').attr('disabled',?false);
????????try?{
????????????var?rows?=?JSON.parse(data);
????????????layer.close(index);
????????????layer.open({
????????????????type:?1,
????????????????title:?false,
????????????????closeBtn:?1,
????????????????shadeClose:?true,
????????????????skin:?'yourclass',
????????????????content:?`<p></p><p></p><p><a><button>下載視頻</button></a></p><p><textarea>${rows['videoUrl']}</textarea><button>復(fù)制鏈接</button></p><p><a><button>下載音頻</button></a></p><video><source>?</source></video>`
????????????????//content:?`<video><source>?</source></video>`
????????????});

????????}?catch?(error)?{
????????????layer.alert('錯(cuò)誤信息:'?+?error,?{
????????????????title:?'異常',
????????????????skin:?'layui-layer-lan',
????????????????closeBtn:?0,
????????????????anim:?4?//動(dòng)畫(huà)類(lèi)型
????????????});
????????????return?false;
????????}
????},
????error:?function?(err)?{
????????console.log(err);
????????layer.close(index);
????????$('.qsy-submit').attr('disabled',?false);
????},
????done:?function?()?{
????????layer.close(index);
????}})})

注意:我們?cè)谧约旱木W(wǎng)站中引用其它網(wǎng)站的資源URL,由于不在同一個(gè)域名下referrer 不同,通常會(huì)遇到三方網(wǎng)站的防盜鏈攔截,所以要想正常訪(fǎng)問(wèn)三方資源,必須要隱藏請(qǐng)求的referrer,頁(yè)面中設(shè)置如下參數(shù)。

?<!-- 解決訪(fǎng)問(wèn)視頻url 請(qǐng)求403異常 -->
?<meta>

還簡(jiǎn)單做了下移動(dòng)端適配,樣式看著還可以,但是功能使用起來(lái)有點(diǎn)差強(qiáng)人意,后邊在做優(yōu)化了。

Java programmers hand-write a Douyin video watermark removal tool

總結(jié)

很多東西就是這樣,沒(méi)認(rèn)真研究之前總感覺(jué)深不可測(cè),可一旦接觸到技術(shù)的本質(zhì),又開(kāi)始笑自己之前好蠢,懂與不懂有時(shí)就查那么一層窗戶(hù)紙。

The above is the detailed content of Java programmers hand-write a Douyin video watermark removal tool. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undress AI Tool

Undress AI Tool

Undress images for free

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

PHP Tutorial
1502
276
How to handle transactions in Java with JDBC? How to handle transactions in Java with JDBC? Aug 02, 2025 pm 12:29 PM

To correctly handle JDBC transactions, you must first turn off the automatic commit mode, then perform multiple operations, and finally commit or rollback according to the results; 1. Call conn.setAutoCommit(false) to start the transaction; 2. Execute multiple SQL operations, such as INSERT and UPDATE; 3. Call conn.commit() if all operations are successful, and call conn.rollback() if an exception occurs to ensure data consistency; at the same time, try-with-resources should be used to manage resources, properly handle exceptions and close connections to avoid connection leakage; in addition, it is recommended to use connection pools and set save points to achieve partial rollback, and keep transactions as short as possible to improve performance.

How to work with Calendar in Java? How to work with Calendar in Java? Aug 02, 2025 am 02:38 AM

Use classes in the java.time package to replace the old Date and Calendar classes; 2. Get the current date and time through LocalDate, LocalDateTime and LocalTime; 3. Create a specific date and time using the of() method; 4. Use the plus/minus method to immutably increase and decrease the time; 5. Use ZonedDateTime and ZoneId to process the time zone; 6. Format and parse date strings through DateTimeFormatter; 7. Use Instant to be compatible with the old date types when necessary; date processing in modern Java should give priority to using java.timeAPI, which provides clear, immutable and linear

Comparing Java Frameworks: Spring Boot vs Quarkus vs Micronaut Comparing Java Frameworks: Spring Boot vs Quarkus vs Micronaut Aug 04, 2025 pm 12:48 PM

Pre-formanceTartuptimeMoryusage, Quarkusandmicronautleadduetocompile-Timeprocessingandgraalvsupport, Withquarkusoftenperforminglightbetterine ServerLess scenarios.2.Thyvelopecosyste,

Understanding Network Ports and Firewalls Understanding Network Ports and Firewalls Aug 01, 2025 am 06:40 AM

Networkportsandfirewallsworktogethertoenablecommunicationwhileensuringsecurity.1.Networkportsarevirtualendpointsnumbered0–65535,withwell-knownportslike80(HTTP),443(HTTPS),22(SSH),and25(SMTP)identifyingspecificservices.2.PortsoperateoverTCP(reliable,c

How does garbage collection work in Java? How does garbage collection work in Java? Aug 02, 2025 pm 01:55 PM

Java's garbage collection (GC) is a mechanism that automatically manages memory, which reduces the risk of memory leakage by reclaiming unreachable objects. 1.GC judges the accessibility of the object from the root object (such as stack variables, active threads, static fields, etc.), and unreachable objects are marked as garbage. 2. Based on the mark-clearing algorithm, mark all reachable objects and clear unmarked objects. 3. Adopt a generational collection strategy: the new generation (Eden, S0, S1) frequently executes MinorGC; the elderly performs less but takes longer to perform MajorGC; Metaspace stores class metadata. 4. JVM provides a variety of GC devices: SerialGC is suitable for small applications; ParallelGC improves throughput; CMS reduces

Using HTML `input` Types for User Data Using HTML `input` Types for User Data Aug 03, 2025 am 11:07 AM

Choosing the right HTMLinput type can improve data accuracy, enhance user experience, and improve usability. 1. Select the corresponding input types according to the data type, such as text, email, tel, number and date, which can automatically checksum and adapt to the keyboard; 2. Use HTML5 to add new types such as url, color, range and search, which can provide a more intuitive interaction method; 3. Use placeholder and required attributes to improve the efficiency and accuracy of form filling, but it should be noted that placeholder cannot replace label.

Comparing Java Build Tools: Maven vs. Gradle Comparing Java Build Tools: Maven vs. Gradle Aug 03, 2025 pm 01:36 PM

Gradleisthebetterchoiceformostnewprojectsduetoitssuperiorflexibility,performance,andmoderntoolingsupport.1.Gradle’sGroovy/KotlinDSLismoreconciseandexpressivethanMaven’sverboseXML.2.GradleoutperformsMaveninbuildspeedwithincrementalcompilation,buildcac

go by example defer statement explained go by example defer statement explained Aug 02, 2025 am 06:26 AM

defer is used to perform specified operations before the function returns, such as cleaning resources; parameters are evaluated immediately when defer, and the functions are executed in the order of last-in-first-out (LIFO); 1. Multiple defers are executed in reverse order of declarations; 2. Commonly used for secure cleaning such as file closing; 3. The named return value can be modified; 4. It will be executed even if panic occurs, suitable for recovery; 5. Avoid abuse of defer in loops to prevent resource leakage; correct use can improve code security and readability.

See all articles