#!/usr/bin/env python3 import requests from bs4 import BeautifulSoup as Soup from sys import argv headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:92.0) Gecko/20100101 Firefox/92.0' , 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' , 'Accept-Language': 'en-US,en;q=0.5', 'Content-Type': 'application/x-www-form-urlencoded' , 'Origin': 'https://twitchemotes.com' , 'Alt-Used': 'twitchemotes.com' , 'Connection': 'keep-alive' , 'Referer': 'https://twitchemotes.com/channels/8683614' , 'Upgrade-Insecure-Requests': '1' , 'Sec-Fetch-Dest': 'document' , 'Sec-Fetch-Mode': 'navigate' , 'Sec-Fetch-Site': 'same-origin' , 'Sec-Fetch-User': '?1' , 'TE': 'trailers' } channel = argv[1] if len(argv) > 1 else 'zfg1' channel_page = requests.post("https://twitchemotes.com/search/channel", data={"query": channel, "source": "nav-bar"}, headers=headers).text soup = Soup(channel_page, "html.parser") print(f"mkdir {channel}") for img in soup.find_all("img", {"class": "emote"}): print(f"curl {img['src']} -o {channel}/{img['data-regex']}.png")