Last active
September 15, 2022 23:51
-
-
Save Enmn/d65e6f7ca5412fb305e56c49e89a7857 to your computer and use it in GitHub Desktop.
A script or a very simple tool that downloads any icon, whether it is paid or not. Be careful, we are not responsible for anything bad that happens from you, you must also download (aiohttp and aiofiles and pystyle) we only support two websites and they are (icon8s.com and www.iconfinder.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 os | |
import aiohttp | |
import asyncio | |
import aiofiles | |
from urllib.parse import urlparse | |
from bs4 import BeautifulSoup | |
from pystyle import * | |
# Colors Python | |
cyan = "\033[1;36m" | |
red = "\033[1;31m" | |
white = "\033[1;37m" | |
green = "\033[1;32m" | |
reset = "\033[0;0m" | |
def close(): | |
os.system('cls' if os.name == 'nt' else 'clear') | |
def logo(): | |
close() | |
txt = """\n ______ ______ ________ ________ __ __ ________ _______\n| \ / \ | \| \| \ / \| \| \\\n \$$$$$$ | $$$$$$\| $$$$$$$$| $$$$$$$$| $$ / $$| $$$$$$$$| $$$$$$$\\\n | $$ ______| $$___\$$| $$__ | $$__ | $$/ $$ | $$__ | $$__| $$\n | $$| \\\\$$ \ | $$ \ | $$ \ | $$ $$ | $$ \ | $$ $$\n | $$ \$$$$$$_\$$$$$$\| $$$$$ | $$$$$ | $$$$$\ | $$$$$ | $$$$$$$\\\n _| $$_ | \__| $$| $$_____ | $$_____ | $$ \$$\ | $$_____ | $$ | $$\n| $$ \ \$$ $$| $$ \| $$ \| $$ \$$\| $$ \| $$ | $$\n \$$$$$$ \$$$$$$ \$$$$$$$$ \$$$$$$$$ \$$ \$$ \$$$$$$$$ \$$ \$$ | |
\n NOTE - WE DO NOT ASSUME ANY LIABILITY WHATSOEVER FROM YOU !!\n BE RESPONSIBLE FOR ANYTHING BAD THAT HAPPENS TO YOU\n CODED BY - https://github.com/Enmn\n\n""" | |
print( | |
Colorate.Vertical( | |
Colors.DynamicMIX((Col.light_blue, Col.cyan)), Center.XCenter(txt) | |
) | |
) | |
async def Fetch(url, text, size): | |
domain = url.split("//")[-1].split("/")[0].split('?')[0] | |
if domain == 'icons8.com': | |
soup = BeautifulSoup(text, 'lxml') | |
try: | |
uri = soup.find_all('img')[29]['srcset'].split(" ")[0] | |
except: | |
close() | |
return red + "\nERROR: It seems that there is a problem or an error with the site that may have changed its script" | |
UrlSplit = uri.split('/') | |
Url = 'https://img.icons8.com/' + UrlSplit[3] + '/' + str(size) + '/' + UrlSplit[5] | |
return Url | |
elif domain == 'www.iconfinder.com': | |
soup = BeautifulSoup(text, "lxml") | |
try: | |
uri = str(soup.find_all('img')[3]['srcset']).split(" ")[0] | |
except: | |
close() | |
return red + "\nERROR: It seems that there is a problem or an error with the site that may have changed its script" | |
UrlSplit = uri.split('/') | |
Url = "https://"+ UrlSplit[2] + "/data/icons/" + UrlSplit[5] + "/" + UrlSplit[6] + '/' + UrlSplit[7][:-8] + str(size) + '.png' | |
return Url | |
async def main(): | |
url = input(red + f"[{white + ' + ' + red}] Please Enter the Url: " + cyan) | |
Checkdomain = url.split("//")[-1].split("/")[0].split('?')[0] | |
if Checkdomain == "icons8.com" or Checkdomain == "www.iconfinder.com": | |
async with aiohttp.ClientSession() as session: | |
async with session.get(url) as response: | |
print(red + "\nSizes available:") | |
print(red + "1. " + cyan + "Customize size") | |
print(red + "2. " + cyan + "512px") | |
print(red + "3. " + cyan + "256px") | |
print(red + "4. " + cyan + "128px") | |
print(red + "5. " + cyan + "64px") | |
print(red + "6. " + cyan + "32px") | |
print(red + "7. " + cyan + "16px") | |
choose = input(red + f"\n[{white + ' + ' + red}] Please Enter the Size You Want to Download: " + cyan) | |
if choose == '1': | |
size = int(input(red + f"\n[{white + ' + ' + red}] Please Enter the Size You Want: " + cyan)) | |
elif choose == '2': | |
size = 512 | |
elif choose == '3': | |
size = 256 | |
elif choose == '4': | |
size = 128 | |
elif choose == '5': | |
size = 64 | |
elif choose == '6': | |
size = 32 | |
elif choose == '7': | |
size = 16 | |
path = input(red + f"\n[{white + ' + ' + red}] Please Enter the Path or Name of the File to be Downloaded: " + cyan) | |
async with session.get(await Fetch(url, await response.text(), size)) as client: | |
if client.status == 200: | |
file = await aiofiles.open(path, mode='wb') | |
await file.write(await client.read()) | |
await file.close() | |
print(green + "The file or icon has been uploaded successfully !!!" + reset) | |
else: | |
close() | |
print(red + '\nSorry, the link you provided is not supported by the tool' + reset) | |
if __name__ == "__main__": | |
logo() | |
loop = asyncio.new_event_loop() | |
asyncio.set_event_loop(loop) | |
loop.run_until_complete(main()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment