SubEsUtilities.py 文件源码

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

项目:service.subtitles.tusubtitulo 作者: josecurioso2 项目源码 文件源码
def buildURL(tvshow, season, episode):
    episodeFetch = ""
    try:
        APIKey = "AIzaSyAm6QlezxEd4N2flR2QO6aVYQ3cx_K4xsw"
        googleCSE = "https://www.googleapis.com/customsearch/v1?key=" + APIKey + "&cx=" + CSX + "&fields=items(title,link)&q="; #separe spaces with +
        searchURL = googleCSE + tvshow.replace(" ", "+")

        page = urllib.urlopen(searchURL).read()
        data = json.loads(page)
        showIdWord = data["items"][0]["title"].strip().strip("TuSubtitulo").strip().strip("-").strip().replace(" ", "-")

        episodeFetch = "https://www.tusubtitulo.com/showsub.php?ushow=" + showIdWord.lower() + "&useason=" + str(season) + "&uepisode=" + str(episode)

    except:
        APIKey = "AIzaSyAdtBdgZnLvZAcskQVYZcMLSnPu57z4HGA"
        googleCSE = "https://www.googleapis.com/customsearch/v1?key=" + APIKey + "&cx=" + CSX + "&fields=items(title,link)&q="; #separe spaces with +
        searchURL = googleCSE + tvshow.replace(" ", "+")

        page = urllib.urlopen(searchURL).read()
        data = json.loads(page)
        showIdWord = data["items"][0]["title"].strip().strip("TuSubtitulo").strip().strip("-").strip().replace(" ", "-")

        episodeFetch = "https://www.tusubtitulo.com/showsub.php?ushow=" + showIdWord.lower() + "&useason=" + str(season) + "&uepisode=" + str(episode)


    log(__name__, "EpisodeLink %s" % episodeFetch)
    return episodeFetch
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号