Skip to content

Instantly share code, notes, and snippets.

View Lesmiscore's full-sized avatar
💭
🤔

Lesmiscore Lesmiscore

💭
🤔
  • なぞのばしょ
  • Mystery Zone, Pokémon
View GitHub Profile
@Lesmiscore
Lesmiscore / pxu2gdl.py
Last active December 17, 2022 17:34
PixivUtil2 to galley-dl migration script
### PixivUtil2 to galley-dl migration script
# this assumes that:
# - FIRST FOUR filename format options in PixivUtil2 (i.e. filenameFormat, filenameMangaFormat, filenameInfoFormat, filenameMangaInfoFormat) are set to
# "%artist% (%member_id%)-%urlFilename%-%title%" (should be default)
# - PixivUtil2 hasn't modified, or very slight (such as fixing image ID and page number into a certain length)
# - "archive-format" options in gallery-dl for pixiv category is default
# usage: python3 pxu2gdl.py
[debug] Command-line config: ['--force-over', '-v', 'https://youtube.com/clip/UgkxdIc_hmqiDzYn3zoGbskyrVEnI4t_1Sod']
[debug] Encodings: locale UTF-8, fs utf-8, pref UTF-8, out utf-8 (No ANSI), error utf-8 (No ANSI), screen utf-8 (No ANSI)
[debug] yt-dlp version 2022.06.22.1 [a86e01e]
[debug] Python version 3.10.4 (CPython 64bit) - Linux-5.15.0-33-generic-x86_64-with-glibc2.35
[debug] Checking exe version: ffmpeg -bsfs
[debug] Checking exe version: ffprobe -bsfs
[debug] exe versions: ffmpeg 4.4.2 (setts), ffprobe 4.4.2, rtmpdump 2.4
[debug] Optional libraries: Cryptodome-3.14.1, brotli-1.0.9, certifi-2022.06.15, mutagen-1.45.1, sqlite3-2.6.0, websockets-10.3
[debug] Proxy map: {}
[debug] [youtube:clip] Extracting URL: https://youtube.com/clip/UgkxdIc_hmqiDzYn3zoGbskyrVEnI4t_1Sod
=== RUN TestIntegration
fstests.go:417: Using remote "TestDiscord:"
=== RUN TestIntegration/FsCheckWrap
fstests.go:458: Not a wrapping Fs
=== RUN TestIntegration/FsCommand
fstests.go:486: No commands in this remote
=== RUN TestIntegration/FsRmdirNotFound
fstests.go:504:
Error Trace: fstests.go:504
Error: An error is expected but got nil.
@Lesmiscore
Lesmiscore / a.py
Last active October 27, 2023 22:42
modify baseMediaDecodeTime and sample durations in MP4 in realtime to fix PTS
import tempfile
import time
import subprocess
import sys
from yt_dlp.ts_parser import (
write_mp4_boxes,
parse_mp4_boxes,
pack_be32,
pack_be64,
unpack_ver_flags,
@Lesmiscore
Lesmiscore / conv.sh
Last active June 5, 2022 11:44
script to convert file's cover art to an attachment in mka
#!/bin/bash
set -xe
mimetype(){
file -i "$@" | grep -Eo '[a-z-]+/[a-z-]+;' | tr -d ';'
}
extes(){
file -i "$@" | awk '{ print $2 }' | tr -d ';' | sed -E 's%^.+/%%'
}
@Lesmiscore
Lesmiscore / close_fd.sh
Created February 24, 2022 15:31
script to close FDs using gdb
( for I in {5..30} ; do echo call '(int)' close'('$I')' ; done ; echo detach ) | sudo gdb -p 425335 -x -
@Lesmiscore
Lesmiscore / yt-troll.js
Created February 18, 2022 14:07
Really blocks certain formats on YouTube
// ==UserScript==
// @name Youtube H.264
// @namespace http://www.youtube.com
// @version 1.1.2
// @description use H.264 on youtube. based on https://github.com/erkserkserks/h264ify.
// @match http://youtube.com/*
// @match https://youtube.com/*
// @match http://www.youtube.com/*
// @match https://www.youtube.com/*
// @grant all
[debug] Command-line config: ['2BC39A882LE', '--check-formats', '--verbose', '--skip-download']
[debug] Encodings: locale UTF-8, fs utf-8, out utf-8 (No ANSI), err utf-8 (No ANSI), pref UTF-8
[debug] yt-dlp version 2022.01.21 [f20d607b0]
[debug] Python version 3.9.10 (CPython 64bit) - Linux-5.13.0-25-generic-x86_64-with-glibc2.34
[debug] exe versions: ffmpeg 4.4 (setts), ffprobe 4.4
[debug] Optional libraries: Crypto, sqlite
[debug] Proxy map: {}
[debug] [youtube] Extracting URL: 2BC39A882LE
[youtube] 2BC39A882LE: Downloading webpage
[youtube] 2BC39A882LE: Downloading android player API JSON
@Lesmiscore
Lesmiscore / a.diff
Created December 15, 2021 15:02
trying to handle Ctrl+C on windows
diff --git a/yt_dlp/downloader/fragment.py b/yt_dlp/downloader/fragment.py
index 3d66ae19d..b5e50496b 100644
--- a/yt_dlp/downloader/fragment.py
+++ b/yt_dlp/downloader/fragment.py
@@ -4,6 +4,8 @@ import os
import time
import json
import http.client
+import threading
+import signal
@Lesmiscore
Lesmiscore / refined.css
Created December 9, 2021 17:11
CSS to make frame smaller, but keeping text size mostly same
.blob-num, .blob-code-inner{
font-size: 14px;
}
html {
min-width: 1050px;
transform: scale(0.9);
transform-origin: 0 0;
}