I needed some Bengali fonts for a project and I found it quite tiresome to download multiple fonts quickly from LipiGhor as well as FontBD. So I wrote a PYTHON script for downloading all the fonts of these websites. You may need to run pip install requests
before executing the script.
# FontBD font downloader
import re
import requests
import pathlib
OUTPUT_FOLDER = "fontbd_fonts"
PAGES = 5
URL = "https://fontbd.com/free-fonts/page/"
DOWNLOAD_URL = "https://fontbd.com/download-font?cp-font-id="
REGEX = "href=\"(https://fontbd.com/free-font/.*/)\""
REGEX2 = "cp-font-id=(\d+)"
for i in range(1, PAGES+1):
html = requests.get(URL + str(i)).text
for link in re.findall(REGEX, html):
font = link.split("/")[-2]
html2 = requests.get(link).text
download = DOWNLOAD_URL + re.search(REGEX2, html2).group(1)
res = requests.get(download, stream=True)
folder = pathlib.Path(OUTPUT_FOLDER)
folder.mkdir(exist_ok=True)
with open((folder / font).with_suffix(".zip"), "wb") as file:
for chunk in res.iter_content(chunk_size=512):
if chunk:
file.write(chunk)
print("Downloaded:" + font.rjust(40))
print("Done!")
IMPORTANT: There are copyright rules and some conditions of these fonts. Please read here. I am not responsible for anything you do.
Great work brother , really appreciable . Keep it up .