Download Watermark‑Free Douyin Videos with a Simple Python Script
This article explains a streamlined method to extract and download watermark‑free Douyin short videos by inspecting network requests, locating hidden video URLs, and using a concise Python script with the jsonpath library, highlighting its advantages and remaining limitations.
1. Use a Simpler Method
In a previous blog I constructed URLs to fetch Douyin short videos, but today I discovered a much simpler approach that eliminates many analysis steps.
The new method involves opening any Douyin user page (e.g., iQIYI Sports), opening the browser developer tools, selecting the Network tab, filtering XHR requests, and examining the captured packets.
In the preview tab, navigate to video → download_addr → url_list; the URLs listed there are the actual video links, hidden deep but directly usable.
Further inspection of the play_addr field reveals another link pointing to the watermark‑free version of the video.
2. Code
Install the required jsonpath module: pip install jsonpath The following Python script extracts video titles and watermark‑free URLs, then downloads the videos:
import requests
import json
import jsonpath
class Douyin:
def page_num(self, max_cursor):
# Random string required by the API
random_field = '00nvcRAUjgJQBMjqpgesfdNJ72&dytk=4a01c95562f1f10264fb14086512f919'
# Construct request URL
url = ('https://www.iesdouyin.com/web/api/v2/aweme/post/'
'?sec_uid=MS4wLjABAAAAU7Bwg8WznVaafqWLyLUwcVUf9LgrKGYmctJ3n5SwlOA'
'&count=21&max_cursor=' + str(max_cursor) +
'&aid=1128&_signature=' + random_field)
# Request headers
headers = {
'user-agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.129 Safari/537.36',
}
response = requests.get(url, headers=headers).text
resp = json.loads(response)
max_cursor = resp['max_cursor']
for data in resp['aweme_list']:
video_title = data['desc']
video_url = jsonpath.jsonpath(data, '$..paly_addr')
for a in video_url:
video_realurl = a['url_list'][1]
video = requests.get(video_realurl, headers=headers).content
with open('t/' + video_title, 'wb') as f:
print('Downloading:', video_title)
f.write(video)
if max_cursor == 0:
return 1
else:
self.page_num(max_cursor)
if __name__ == '__main__':
douyin = Douyin()
douyin.page_num(max_cursor=0)3. Advantages
This approach removes many URL‑construction steps, does not rely on a WebDriver (so no browser restrictions), runs faster, and directly yields watermark‑free videos.
4. Disadvantages
The method still requires a manually generated random string, making the process somewhat cumbersome.
Original article: https://www.cnblogs.com/cherish-hao/p/12828027.html
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
MaGe Linux Operations
Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
