Created
September 25, 2024 00:51
-
-
Save lyricalpaws/40c8f5cd6bb98c6c6dbc023118465a49 to your computer and use it in GitHub Desktop.
Grabs all of Marques Brownlee's shitty scam app (panels.art)'s wallpapers
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 | |
import os | |
import time | |
from urllib.parse import urlparse | |
def downloadImage(url, filePath): | |
try: | |
response = requests.get(url) | |
if response.status_code == 200: | |
with open(filePath, 'wb') as f: | |
f.write(response.content) | |
else: | |
print(f"Failed to download image: {response.status_code}") | |
except Exception as e: | |
print(f"Error: {e}") | |
def main(): | |
print("""\ | |
.__ .__ .__ | |
| | ___.__._______|__| ____ _____ | | ___________ __ _ ________ | |
| |< | |\_ __ \ |/ ___\\__ \ | | \____ \__ \\ \/ \/ / ___/ | |
| |_\___ | | | \/ \ \___ / __ \| |_| |_> > __ \\ /\___ \ | |
|____/ ____| |__| |__|\___ >____ /____/ __(____ /\/\_//____ > | |
\/ \/ \/ |__| \/ \/ | |
""") | |
url = "https://storage.googleapis.com/panels-api/data/20240916/media-1a-i-p~s" | |
try: | |
response = requests.request("GET", url) | |
downloadDir = f"{os.getcwd()}/download" | |
if os.path.exists(downloadDir) is False: | |
os.mkdir(downloadDir) | |
print("Download folder does not exist! Making one!") | |
jsonData = response.json() | |
data = jsonData.get('data') | |
fileIndex = 1 | |
for key in data: | |
subProperty = data[key] | |
if subProperty and 'dhd' in subProperty: | |
imageUrl = subProperty['dhd'] | |
print("🔍 Found image URL!") | |
time.sleep(1) | |
ext = os.path.splitext(urlparse(imageUrl).path)[1] or '.jpg' | |
fileName = f"{fileIndex}{ext}" | |
filePath = os.path.join(downloadDir, fileName) | |
downloadImage(imageUrl, filePath) | |
print(f"🖼️ Saved image to {filePath}") | |
fileIndex += 1 | |
except requests.exceptions.RequestException as e: | |
print(e) | |
if __name__ =="__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment