Created
April 7, 2024 06:08
-
-
Save rothgar/f7be7a00c70780e91604ea7f997f87b1 to your computer and use it in GitHub Desktop.
Download your tiktok videos with nushell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env nu | |
# download your tiktok archive data and extract the user_data.json file | |
let data = (open user_data.json) | |
mkdir archive | |
# loop through videos | |
$data.Video.Videos.VideoList | each { |video| | |
# create a file name tt_$video.Date (remove spaces) | |
let filename = "tt_" + ($video.Date | into datetime | format date "%Y-%m-%d_%H-%M") | |
# skip files that already exist | |
if not ( $"archive/($filename).mp4" | path exists ) { | |
# Download the file with progress | |
http get -e $"($video.Link)" | save -p $"archive/($filename).mp4" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment