Skip to content

Instantly share code, notes, and snippets.

@wewnumam
Created June 11, 2023 03:08
Show Gist options
  • Save wewnumam/457b84f2fbae158fe8d65ef4c2e6a8b1 to your computer and use it in GitHub Desktop.
Save wewnumam/457b84f2fbae158fe8d65ef4c2e6a8b1 to your computer and use it in GitHub Desktop.
Frequently Used Codes

Python

Rename .mp4 video to md5 hash

import os, hashlib, pathlib

folder = pathlib.Path('./').rglob('*.mp4')
files = [x for x in folder]

for name in files:
	f = open(name, 'r')
	md5hash = hashlib.md5(f.name.encode())
	os.rename(r'./' + f.name, r'./' + md5hash.hexdigest() + '.mp4')
	f.close()

Bash

youtube-dl download from list

#usr/bin/bash

for url in $(cat list.txt); do 
	youtube-dl $url -o './%(id)s.%(ext)s'
	echo $url
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment