2016-10-25 2 views
1

twich.tv emotes를 다운로드해야합니다. Phyton 스크립트를 찾았지만 작동하지 않습니다. 스크립트를 쓴 사람이 Twich 그래 난 더 이상 그 API의 일을 생각하지 않는다 page with API docAPI를 통해 twich 감정을 얻는 방법 ??

import urllib 
import os 
import json 

if not os.path.exists('./emotes'): 
    os.makedirs('./emotes') 
print('Saving emotes to folder: ' + os.path.abspath('./emotes') + '...') 
print('Grabbing emote list...') 
emotes = json.load(urllib.urlopen('https://twitchemotes.com/api_cache/v2/global.json')) 
for code, emote in emotes['emotes'].items(): 
    print('Downloading: ' + code + '...') 
    urllib.urlretrieve('http:' + emotes['template']['large'].replace('{image_id}', str(emote['image_id'])), 
         './emotes/' + code + '.png') 
print('Done! Kappa') 

답변

0

그건 cloudfare 또는 등을 활성화했다. 그래도 https://api.twitch.tv/kraken/chat/emoticons/을 사용할 수있는 것처럼 보입니다.

import urllib 
import os 
import json 

if not os.path.exists('./emotes'): 
    os.makedirs('./emotes') 
print('Saving emotes to folder: ' + os.path.abspath('./emotes') + '...') 
print('Grabbing emote list...') 
emotes = json.load(urllib.urlopen('https://api.twitch.tv/kraken/chat/emoticons/')) 
for emote in emotes['emoticons']: 
    code = emote['regex'] 
    print('Downloading: ' + code + '...') 
    urllib.urlretrieve(emote['images'][0]['url'], './emotes/' + code + '.png') 
print('Done! Kappa') 
관련 문제