Skip to content

Instantly share code, notes, and snippets.

View Fradhyle's full-sized avatar

Donghyeok Im Fradhyle

View GitHub Profile
@Fradhyle
Fradhyle / insta_down.py
Last active February 14, 2026 14:26
Download an image from Instagram
import re
from pathlib import Path
from urllib.parse import urlparse
import requests
def get_image(html_tag: str):
# Find src attribute in the HTML tag
src_match = re.search(r'src="([^"]+)"', html_tag)
@Fradhyle
Fradhyle / app.py
Last active September 22, 2025 02:21
Find media differences in two directories
from pathlib import Path
from typing import Final
global SKIP_EXTS
SKIP_EXTS: Final[set[str]] = {".tmp", ".log", ".ini", ".zip", ".lrv", ".insv"}
def count_ext(path: Path) -> dict[str, int]:
"""Count the number of files for each file extension in the given directory and its subdirectories.
<!DOCTYPE html>
<html lang="ko>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
</head>
<body>
<!-- body contents here -->
</body>
</html>
@Fradhyle
Fradhyle / replace_multiple.py
Created December 1, 2024 08:43
Replace multiple substring using Python re library
# Make dictionary.
# Key is the original substring that you want to change.
# Value is the new substring that you want to enter.
replace_words: dict = {"Original substring": "New substring",}
# Call all keys and values in dictionary, escape special character and replace dictionary for replacement with escaped one.
# re.escape will automatically escapes special characters in keys of dictionary (The original substring)
# Only key will be used to make RegEx pattern, so value doesn't need to be escaped.
replace_words: dict = dict((re.escape(k), v) for k, v in replace_words.items())