Created
February 20, 2023 22:25
-
-
Save RazhanHameed/004000e215fa1d3c27fc45d24b22b309 to your computer and use it in GitHub Desktop.
A script that downloads all the fonts on kurdfonts.com
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from bs4 import BeautifulSoup | |
import time | |
url = 'https://www.kurdfonts.com/browse/categories' | |
response = requests.get(url) | |
soup = BeautifulSoup(response.content, 'html.parser') | |
ul = soup.find('ul', {'class': 'list-group'}) | |
for page in ul.find_all('a'): | |
soup = BeautifulSoup(requests.get(page.get('href')).content, 'html.parser') | |
for link in soup.find_all('a'): | |
if link.get('class') is not None and 'btn-success' in link.get('class'): | |
print(link.get('href')) | |
resp = requests.get(link.get('href')) | |
soup = BeautifulSoup(resp.content, 'html.parser') | |
link = soup.select('a[href^="https://www.kurdfonts.com/dl/"]') | |
print("Downloading: " + link[0].get('href')) | |
resp = requests.get(link[0].get('href')) | |
# write font file to disk | |
with open("kurdfonts/" +link[0].get('href').split('/')[-1], 'wb') as f: | |
f.write(resp.content) | |
time.sleep(1) | |
print("Downloaded: " + link[0].get('href').split('/')[-1]) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment