【问题标题】:How to get twich emotes via API??如何通过 API 获得抽搐表情?
【发布时间】:2016-10-25 06:50:36
【问题描述】:

我需要下载 twich.tv 表情。我找到了 Phyton 脚本,但这不起作用。写脚本的人说 Twich 激活 cloudfare 等等。那个page with API doc

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')

【问题讨论】:

    标签: python json api


    【解决方案1】:

    是的,我认为 API 不再有效。似乎您可以使用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')
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-04-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-10-13
      相关资源
      最近更新 更多