Last active 1633467305

A script to download all twitch emotes for a given channel. pipe to bash or something idk

Alyssa Smith revised this gist 1633503305. Go to revision

1 file changed, 29 insertions

twitch_emotes.py(file created)

@@ -0,0 +1,29 @@
1 + #!/usr/bin/env python3
2 + import requests
3 + from bs4 import BeautifulSoup as Soup
4 + from sys import argv
5 +
6 + headers = {
7 + 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:92.0) Gecko/20100101 Firefox/92.0' ,
8 + 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' ,
9 + 'Accept-Language': 'en-US,en;q=0.5',
10 + 'Content-Type': 'application/x-www-form-urlencoded' ,
11 + 'Origin': 'https://twitchemotes.com' ,
12 + 'Alt-Used': 'twitchemotes.com' ,
13 + 'Connection': 'keep-alive' ,
14 + 'Referer': 'https://twitchemotes.com/channels/8683614' ,
15 + 'Upgrade-Insecure-Requests': '1' ,
16 + 'Sec-Fetch-Dest': 'document' ,
17 + 'Sec-Fetch-Mode': 'navigate' ,
18 + 'Sec-Fetch-Site': 'same-origin' ,
19 + 'Sec-Fetch-User': '?1' ,
20 + 'TE': 'trailers'
21 + }
22 +
23 + channel = argv[1] if len(argv) > 1 else 'zfg1'
24 + channel_page = requests.post("https://twitchemotes.com/search/channel", data={"query": channel, "source": "nav-bar"}, headers=headers).text
25 + soup = Soup(channel_page, "html.parser")
26 +
27 + print(f"mkdir {channel}")
28 + for img in soup.find_all("img", {"class": "emote"}):
29 + print(f"curl {img['src']} -o {channel}/{img['data-regex']}.png")
Newer Older