question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

New mechanism for tiktok without watermark

See original GitHub issue

I found a new mechanism for downloading tiktok videos without watermark. I wrote a proof of concept in nodejs but I’m not too experienced with python so if anyone can help implement it that’d be great.

const request = require('request-promise');

async function downloadVideo(uri){
    // User-Agent is required to fetch the right page.
    const options = {
        url: uri,
        headers: {
            'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:74.0) Gecko/20100101 Firefox/74.0'
        }
    }
    const videoPage = await request(options);
    
    // Extract JSON data from script tag.
    const regex = /<script id="__NEXT_DATA__" type="application\/json" crossorigin="anonymous">([^]*)<\/script><script crossorigin="anonymous" nomodule=/.exec(videoPage);
    if(regex == null) return console.error('Unable to extract data from page.');

    // Extract watermarked video URL after checking that the page is actually a video.
    const videoProps = JSON.parse(regex[1]);
    const videoData = videoProps.props.pageProps.videoData;
    if(videoData == undefined) return console.error('Unable to extract video data from page data.');
    const videoUrl = videoData.itemInfos.video.urls[0];

    // This is the magic trick. The video ID is hidding inside the watermarked video file. We can extract it by searching for "vid:" inside the video.
    const videoResult = await request(videoUrl);
    const position = Buffer.from(videoResult).indexOf('vid:');
    if(position == -1) return console.error('Could not find video ID in watermarked video.');
    const videoId = Buffer.from(videoResult).slice(position + 4, position + 36).toString();
    // You can retrieve the unwatermarked video with this URL and video ID.
    console.log(`https://api2.musical.ly/aweme/v1/playwm/?video_id=${videoId}`);
}

downloadVideo('https://www.tiktok.com/@user/video/id');

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:9
  • Comments:18

github_iconTop GitHub Comments

7reactions
Zipdoxcommented, Jun 22, 2020

againt not working for some videos… url like https://api2.musical.ly/aweme/v1/playwm/?video_id={video_id} is still working for new videos, perhaps old videos moved to another data server url. Any one else decisions?

There has been a recent change. The API URL changed and you need a user-agent to fetch the watermarkless video. I wrote a userscript to download TikTok vids without watermark.

The gist is that you fetch the watermarked video, search the file for ‘vid:’ and copy Here’s a breakdown of how it works:

2reactions
hamaz562006commented, Jul 31, 2020

againt not working for some videos… url like https://api2.musical.ly/aweme/v1/playwm/?video_id={video_id} is still working for new videos, perhaps old videos moved to another data server url. Any one else decisions?

There has been a recent change. The API URL changed and you need a user-agent to fetch the watermarkless video. I wrote a userscript to download TikTok vids without watermark.

The gist is that you fetch the watermarked video, search the file for ‘vid:’ and copy Here’s a breakdown of how it works:

this method don’t work on some videoes (secret ID can’t be found) please fix

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to download a video without TikTok watermark?
In this new guide on the global social network called TikTok, we will learn how to download a video without TikTok watermark.
Read more >
How to Download TikTok Videos (Without a Watermark)
The best bet is to download the video without any watermark in the first place, for free. For this to work, you need...
Read more >
4 Ways to Download Your TikTok Videos Without The ...
MusicallyDown is another great free tool to download TikTok videos without the watermark. With this tool, you can download unlimited TikTok ...
Read more >
How to Download TikTok Videos Without Watermark on iPhone
RepostTik is one of the best ways to remove TikTok video watermarks by downloading the original file. During the procedure, no watermark will...
Read more >
We teach you 5 ways to remove the TikTok watermark - Gearrice
The first way to download TikTok videos without watermark with SnapTok is the traditional way, that is, go to the TikTo video and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found