Skip to content

Instantly share code, notes, and snippets.

View mesalilac's full-sized avatar
❤️

Abdalrzag mesalilac

❤️
View GitHub Profile
@mesalilac
mesalilac / download.sh
Last active September 6, 2025 06:48
yt-dlp script to archive youtube channels
#!/bin/sh
set -euo pipefail
if [ $# -lt 1 ] || [ -z "$1" ]; then
echo "Usage: $0 <Youtube Channel URL> <--check-size?>"
exit 1
fi
CHANNEL_URL="$1" # Example `./download "https://www.youtube.com/@XXXXXXX/videos"`
@mesalilac
mesalilac / gist:021a2655124bed8c61a9140280e6f1ea
Last active September 5, 2025 21:14
download all videos with metadata included
yt-dlp -f "bv*[height=1080]+ba/best[height=1080]" \
-o "%(upload_date>%Y-%m-%d)s - %(title)s.%(ext)s" \
--merge-output-format mp4 \
--write-info-json --write-description --write-thumbnail --write-sub --embed-metadata --embed-thumbnail --embed-subs \
--download-archive archive.txt \
--playlist-reverse \
<CHANNEL_URL>
# one line
yt-dlp -f "bv*[height=1080]+ba/best[height=1080]" -o "%(upload_date>%Y-%m-%d)s - %(title)s.%(ext)s" --merge-output-format mp4 --write-info-json --write-description --write-thumbnail --write-sub --embed-metadata --embed-thumbnail --embed-subs --download-archive archive.txt --playlist-reverse <CHANNEL_URL>
@mesalilac
mesalilac / getAdUrl.js
Last active August 25, 2021 22:25
get video url of youtube ad using javascript
/*
Right click on the video ad.
Select [Stats for nerds].
Open your developer browser console and paste this.
source: https://stackoverflow.com/questions/20874062/how-to-download-video-ads-from-youtube
*/
alert("https://www.youtube.com/watch?v="+$(".html5-video-info-panel-content")
.children[0]
.children[1]
@mesalilac
mesalilac / isPrime.js
Created August 8, 2021 22:03
is prime number
function isPrime(num) {
var prime = num != 1;
for(var i=2; i<num; i++) {
if(num % i == 0) {
prime = false;
break;
}
}
return prime;
}
@mesalilac
mesalilac / sleep.js
Created July 5, 2021 08:30
sleep function javascript
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
function getElementByXpath(path) {
return document.evaluate(path, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
}