This article is about 600 words, it will take about 5 minutes to read it, only for learning, if there are mistakes, please correct.

demand

Douyin platform to download a video, remove the watermark ID in the upper left corner.

Let’s see the watermarking effect first

At this time, it will be found that the videos downloaded by the official tiktok will have a tiktok watermark, which needs to be removed.

Share video

Share a video from Douyin and you will get a copy and address for sharing. The format is as follows.

A don't understand https://v.douyin.com/JdbBqog/ to copy the link and open the trill short video 】 【, watch the video directly!Copy the code

Put the above URL (v.douyin.com/JdbBqog/) Put it in the browser’s simulated mobile mode and see what happens

1. The redirection

Short addresses are redirected,

2. 一个关键的 ajax

Request the following address with the two parameters obtained in the HTML embedded script above.

The request returns a JSON containing some information about the video, including a key parameter URI that is unwatermarked

At this point, tiktok’s official process is over.

3. How to dewatermark?

How it works: Instead of using some artificial intelligence or photoshop to remove the watermark in a certain area, Douyin will save an unwatermarked video, and we just need to find the address of the unwatermarked video.

Say that the principle, the implementation is according to the above to obtain the field URI, and then splicing in a tiktok storage without watermark video address on the finished. (The concatenated address may not be accessible on the browser.) Check out the code

Implementation effect

Node.js code repository

The repository is for learning purposes only

There are two download modes, browser download and command line download

  1. Browser input can be downloaded (convenient to provide interface)
npm start 
or 
node index
Copy the code

use

  1. Download to directory in tool mode (similar to command line tools)
node tool
Copy the code

reference

Mp.weixin.qq.com/s/DF7_b_F1i…

Gitee.com/goldriver/d…