giphycat.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:giphycat 作者: kstrauser 项目源码 文件源码
def get_random_giphy(phrase):
    """Return the URL of a random GIF related to the phrase, if possible"""
    with warnings.catch_warnings():
        warnings.simplefilter('ignore')

        giphy = giphypop.Giphy()

    results = giphy.search_list(phrase=phrase, limit=100)

    if not results:
        raise ValueError('There were no results for that phrase')

    return random.choice(results).media_url
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号