Skip to content

Instantly share code, notes, and snippets.

@alyssadev
Created October 6, 2021 06:55
Show Gist options
  • Save alyssadev/1c26b0ba9400f511cad60484e6da4296 to your computer and use it in GitHub Desktop.
Save alyssadev/1c26b0ba9400f511cad60484e6da4296 to your computer and use it in GitHub Desktop.
A script to download all twitch emotes for a given channel. pipe to bash or something idk
#!/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")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment