Implementation code of short video (douyin) watermark removal tool

Implementation code of short video (douyin) watermark removal tool

Video accounts are very popular now, and people who used to work on Douyin and Kuaishou just moved their previous videos over. But the videos downloaded from the Tik Tok app all have official watermarks? How did you remove this? Oh, no, they should have kept the original video. But there are still many people who directly copy other people’s videos, so how do they remove the watermarks?

In fact, there are already many ready-made tools, such as mini-programs and watermark removal apps that can directly remove watermarks, and some are even paid.

Let’s study it quickly, maybe we can come up with a better tool than theirs.

After a series of fierce operations, including capturing packets and looking at data, it turns out to be extremely simple, and you can remove watermarks from a video in minutes.

In fact, these watermark removal tools are too exaggerated (misleading), and they are not really watermark removal tools at all. Newbies even think that they have done some awesome post-processing on the video to remove the watermark.

In fact, it is just a video downloaded directly without a watermark. Because the videos you see on apps like Tik Tok and Kuaishou do not have official watermarks, so this watermark-free video must exist.

Below I will describe the process of my cracking one by one (taking Douyin as an example).

1. Get the first link first

2. Well, open this link in the browser

Then open the address you just copied, https://v.douyin.com/e1MMESR/.

3. Open the address and find that there is a 302 jump

4. Then when I played the video on the left, it turned out to be a video with a watermark.

We can't see the watermark when we play it in the app, but there is a watermark when we open it in the browser.

5. An ajax request was found in the console, which returned all the information of the video, including the video address.

6. Find the video playback address video.play_addr.url_list[0]

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

The above address is the same as the address of the video player we saw in the console inspection element, but both are watermarked addresses.

At least it is a piece of information, so record this address first.

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

7. Find another way, start from the video list in the personal center

Get the personal video list address (go to the personal center and click share, there will be a copy link) https://v.douyin.com/e1MCMaT/.

8. Open the browser and analyze the interface data from the console

This is the video list data returned by the interface, but it is only the first few, and I haven’t figured out how to get all of them yet.

9. List data analysis, discover new world

The above interface returns the video list data, where each piece of data has richer information and a watermark-free address is found.

Each video has 4 playback addresses, which are probably CDNs used for streaming. In fact, these are the playback addresses without watermarks.

10. Stop searching, the end has been reached

The contents of the above addresses seem to be quite different. After opening them one by one, I found that the first two played directly, while the last two played after 302 jump.

Look at the third address again, it seems a little familiar

//The third address is https://aweme.snssdk.com/aweme/v1/play/?video_id=v0300f760000c0fq7t5t1gvidv0rdtag&line=0&ratio=720p&media_type=4&vr_type=0&improve_bitrate=0&is_play_url=1&source=PackSourceEnum_DOUYIN_REFLOW
 
//Saved above https://aweme.snssdk.com/aweme/v1/playwm/?video_id=v0300f760000c0fq7t5t1gvidv0rdtag&ratio=720p&line=0

Obviously, the addresses are almost identical, only the parameters are different.

The parameters can be ignored. The only difference is the address /playwm/ and /play/ , with a missing wm .

At this point, we have accomplished our mission. The address without watermark is the one without wm . What is wm ? It is the English abbreviation of watermark .

11. Download is complete

Just open the playback, right-click on the playing video to save, and you're done.

I also did a lot of tests later, and the above approach is ok.

12. How to use Kuaishou?

Kuaishou’s is even simpler, there is nothing hidden at all, and you can directly open the video with a browser to see the watermark-free video. Obviously, Douyin has done more.

Make a download tool?

Now we can download watermark-free videos in two steps, but they are all manual downloads. So we need to make a tool that allows you to download the video with just one click by entering the video address.

How to achieve it? Manual downloading is easy, but if it is done automatically, it will not be so smooth, because the platform has long been aware of this problem and has taken precautions.

There are two solutions below. The ultimate goal is to get the playback address of the video and then download the video.

Implementation Plan A

Use the platform's API interface to get the playback address. However, you are likely to encounter pitfalls. The platform should have a plan for this kind of operation and it will be rejected.

Plan B

This should be simpler and more efficient. Use a headless browser to get the video address, saving the interface request.

Part of the code

The code is not complete yet, I just wrote a video download and got the API request address.

//Download video const path = require('path')
const fs = require('fs')
const request = require('request')
/**
 * Download Video */
function downVideo(url) {
 var fileName = `${+new Date()}.mp4`
 var fullPath = path.resolve('./videos/' + fileName);
 console.log('Start downloading video:', fileName);
 request(encodeURI(url)).on('error', function (err) {
 console.log(error)
 }).pipe(fs.createWriteStream(fullPath)).on('finish', () => {
 console.log('Video downloaded successfully');
 })
 
}
 
const url = 'http://v6-z.douyinvod.com/719423c89357069fffd503a6698436f9/60342b2c/video/tos/cn/tos-cn-ve-15/56505c3774bd46de98d6a49e2315e292/?a=1128&br=4996&bt=1249&cd=0%7C0%7C0&ch=0&cr=0&cs=0&cv=1&dr=0&ds=3&er=&l=2021022300074001020410813542130635&lr=&mime_type=video_mp4&pl=0&qs=0&rc=and1eWxqd3d0MzMzOWkzM0ApZTw2NWhoZGRpNzs7ZTc4OWcpaGRqbGRoaGRmXmEtYXMuMjRjYC0tNC0wc3MzLjY1XzMxNjE2Ly4xMDFhOmNwb2wrbStqdDo%3D&vl=&vr='
downVideo(url)
//Get the API address function getApiUrl(url){
 //Redirect the address passed by the front end to get item_ids and return return new Promise(resolve => {
 request(url, (error, response) => {
  if (!error && response.statusCode == 200) {
  let href = response.request.href;
  let id = '';
  id = href.match(/video\/(\S*)\/\?region/)[1];
  resolve(`https://www.iesdouyin.com/web/api/v2/aweme/iteminfo/?item_ids=${id}`);
  } else {
  resolve(false)
  }
 })
 });
}
 
getApiUrl('xxx').then(api=>{
//xxx
})

I will complete the code later, write a complete "watermark removal" tool, and post it on my own website.

at last

The whole process is not difficult, but it is quite fun. And I found a lot of interesting things. There is a lot of information in the video list above, and I can still explore it.

This concludes the article on how the "watermark removal" tools for short videos (douyin) on the market are implemented. For more content on short video watermark removal tools, please search for previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope you will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Python implements image repair (can be used to remove watermarks)
  • How to use javacv to remove watermarks from images (with code)
  • IcePDF watermark removal method (recommended)
  • Example code of WeChat applet imitating the short video switching effect of TikTok
  • Vue login homepage dynamic background short video production
  • Python uses scrapy crawler to download short videos of the entire site in just 50 lines of code
  • Android imitates WeChat to shoot short videos

<<:  Quickly install MySQL5.7 compressed package on Windows

>>:  How to use nginx to simulate canary release

Recommend

Docker - Summary of 3 ways to modify container mount directories

Method 1: Modify the configuration file (need to ...

How to use javascript to do simple algorithms

Table of contents 1 Question 2 Methods 3 Experime...

Install and build a server environment of PHP+Apache+MySQL on CentOS

Yum (full name Yellow dog Updater, Modified) is a...

Introduction to building a DNS server under centos7

Table of contents 1. Project environment: 2: DNS ...

HTML Basics - Simple Example of Setting Hyperlink Style

*** Example of setting the style of a hyperlink a...

Using JS to determine the existence of elements in an array in ten minutes

Preface In front-end development, you often need ...

Steps to export the fields and related attributes of MySQL tables

Need to export the fields and properties of the t...

When should a website place ads?

I recently discussed "advertising" with...

Disadvantages and reasonable use of MySQL database index

Table of contents Proper use of indexes 1. Disadv...

Some tips on deep optimization to improve website access speed

<br />The website access speed can directly ...

How to manage docker through UI

Docker is being used in more and more scenarios. ...