-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
68 additions
and
65 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,28 @@ | ||
# TwitchEmojiDownloader <img src="https://img.shields.io/static/v1?label=code&message=Python3&color=orange" alt=""> | ||
|
||
Twitch Emoji Downloader는 트위치 스트리머의 이모티콘을 다운로드하는 프로그램입니다.<br> | ||
**이 프로그램은 Python 3.6+버전이 필요합니다.** | ||
|
||
## 목차 | ||
- [설치방법](#설치방법) | ||
- [사용방법](#사용방법) | ||
- [문의](#문의) | ||
- [책임](#책임) | ||
|
||
### 설치방법 | ||
**Git** <code>git clone https://github.com/Kwabang/TwitchEmojiDownloader.git</code><br> | ||
**releases** <code>https://github.com/Kwabang/TwitchEmojiDownloader/releases</code> | ||
|
||
### 사용방법 | ||
1. 모듈설치 <code>pip3 install -r requirements.txt</code> | ||
2. exmaple_config.json을 config.json으로 변경 | ||
3. 트위치 개발자 콘솔에서 API Client_ID 발급후 config.json에 입력<br /> | ||
-참고자료 : https://docs.aws.amazon.com/ko_kr/lumberyard/latest/userguide/chatplay-generate-twitch-client-id.html | ||
4. app.py 실행 <code>python3 app.py</code> | ||
5. 다운로드할 스트리머의 ID입력 ex) <code>다운로드를 원하는 스트리머의 ID를 입력해주세요. : **twitchkr**</code> | ||
|
||
### 문의 | ||
[이메일](mailto:kwabang2827@gmail.com) 또는 [디스코드](https://discordapp.com/invite/z8UBtjp)로 문의를 넣을 수 있습니다. | ||
|
||
### 책임 | ||
프로그램을 이용하여 생기는 문제의 책임은 **사용자**에게 있습니다. | ||
# TwitchEmojiDownloader <img src="https://img.shields.io/static/v1?label=code&message=Python3&color=orange" alt=""> | ||
|
||
Twitch Emoji Downloader는 트위치 스트리머의 이모티콘을 다운로드하는 프로그램입니다.<br> | ||
**이 프로그램은 Python 3.6+버전이 필요합니다.** | ||
|
||
## 목차 | ||
- [설치방법](#설치방법) | ||
- [사용방법](#사용방법) | ||
- [문의](#문의) | ||
- [책임](#책임) | ||
|
||
### 설치방법 | ||
**Git** <code>git clone https://github.com/Kwabang/TwitchEmojiDownloader.git</code><br> | ||
**releases** <code>https://github.com/Kwabang/TwitchEmojiDownloader/releases</code> | ||
|
||
### 사용방법 | ||
1. 모듈설치 <code>pip3 install -r requirements.txt</code> | ||
2. exmaple_config.json을 config.json으로 변경 | ||
3. 트위치 개발자 콘솔에서 API Client_ID 발급후 config.json에 입력<br /> | ||
-참고자료 : https://docs.aws.amazon.com/ko_kr/lumberyard/latest/userguide/chatplay-generate-twitch-client-id.html | ||
4. app.py 실행 <code>python3 app.py</code> | ||
5. 다운로드할 스트리머의 ID입력 ex) <code>다운로드를 원하는 스트리머의 ID를 입력해주세요. : **twitchkr**</code> | ||
|
||
### 문의 | ||
[이메일](mailto:kwabang2827@gmail.com) 또는 [디스코드](https://kwabang.codes/join)로 문의를 넣을 수 있습니다. | ||
|
||
### 책임 | ||
프로그램을 이용하여 생기는 문제의 책임은 **사용자**에게 있습니다. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,40 @@ | ||
import os | ||
import asyncio | ||
import aiohttp | ||
import aiofiles | ||
import json | ||
with open('config.json') as json_file: | ||
json_data = json.load(json_file) | ||
path = json_data["path"] | ||
client_id = json_data["client_id"] | ||
|
||
async def download(streamer): | ||
if not(os.path.isdir(f"{path}{streamer}")): | ||
os.makedirs(os.path.join(f"{path}{streamer}")) | ||
async with aiohttp.ClientSession() as session: | ||
async with session.get(f'https://api.twitch.tv/helix/users?login={streamer}',headers={'Client-ID': f'{client_id}'}) as twitch_id: | ||
data = (await twitch_id.json())['data'][0] | ||
async with session.get(f"https://api.twitchemotes.com/api/v4/channels/{data['id']}") as emote_list: | ||
emote_list = (await emote_list.json())['emotes'] | ||
num = 0 | ||
while True: | ||
try: | ||
async with session.get(f"https://static-cdn.jtvnw.net/emoticons/v1/{emote_list[num]['id']}/3.0") as image_req: | ||
if image_req.status == 200: | ||
image_file = await aiofiles.open(f"{path}{streamer}/{emote_list[num]['code']}.png", mode='wb') | ||
print (f"Downloading {emote_list[num]['code']}") | ||
await image_file.write(await image_req.read()) | ||
await image_file.close() | ||
num+=1 | ||
except IndexError: | ||
print("End!") | ||
break | ||
|
||
if __name__ == "__main__": | ||
streamer = input("다운로드를 원하는 스트리머의 ID를 입력해주세요. : ") | ||
loop = asyncio.get_event_loop() | ||
loop.run_until_complete(download(streamer)) | ||
loop.close() | ||
import os | ||
import asyncio | ||
import aiohttp | ||
import aiofiles | ||
import json | ||
with open('config.json') as json_file: | ||
json_data = json.load(json_file) | ||
path = json_data["path"] | ||
client_id = json_data["client_id"] | ||
token = json_data["token"] | ||
|
||
async def download(streamer): | ||
if not(os.path.isdir(f"{path}{streamer}")): | ||
os.makedirs(os.path.join(f"{path}{streamer}")) | ||
async with aiohttp.ClientSession() as session: | ||
async with session.post(f'https://id.twitch.tv/oauth2/token?client_id={client_id}&client_secret={token}&grant_type=client_credentials') as bearer: | ||
bearer = (await bearer.json())['access_token'] | ||
async with session.get(f'https://api.twitch.tv/helix/users?login={streamer}',headers={'Client-ID': f'{client_id}','Authorization': f'Bearer {bearer}'}) as twitch_id: | ||
data = (await twitch_id.json())['data'][0] | ||
async with session.get(f"https://api.twitchemotes.com/api/v4/channels/{data['id']}") as emote_list: | ||
emote_list = (await emote_list.json())['emotes'] | ||
num = 0 | ||
while True: | ||
try: | ||
async with session.get(f"https://static-cdn.jtvnw.net/emoticons/v1/{emote_list[num]['id']}/3.0") as image_req: | ||
if image_req.status == 200: | ||
image_file = await aiofiles.open(f"{path}{streamer}/{emote_list[num]['code']}.png", mode='wb') | ||
print (f"Downloading {emote_list[num]['code']}") | ||
await image_file.write(await image_req.read()) | ||
await image_file.close() | ||
num+=1 | ||
except IndexError: | ||
print("End!") | ||
break | ||
|
||
if __name__ == "__main__": | ||
streamer = input("다운로드를 원하는 스트리머의 ID를 입력해주세요. : ") | ||
loop = asyncio.get_event_loop() | ||
loop.run_until_complete(download(streamer)) | ||
loop.close() |