def getUrl (self) : url = self.initUrl print("wenfeng url is "+url) result = True if 'youku' in url : getClass = youkuClass.ChaseYouku() print("come to youku ") elif 'sohu' in url : getClass = sohuClass.ChaseSohu() elif 'letv' in url : getClass = letvClass.ChaseLetv() elif 'tudou' in url : getClass = tudouClass.ChaseTudou() getClass.videoLink = url url = getClass.chaseUrl() getClass = youkuClass.ChaseYouku() elif 'bilibili' in url : getClass = bilibiliClass.ChaseBilibili() elif 'acfun' in url : getClass = acfunClass.ChaseAcfun() elif 'iqiyi' in url : getClass = iqiyiClass.ChaseIqiyi() else : result = False if result : result = '' #videoType = self.selectorVal.get() videoType = u'高清' if videoType == u'HD' : videoType = 's' elif videoType == u'超清' : videoType = 'h' elif videoType == u'高清' : videoType = 'n' else : videoType = 's' print("video type is "+videoType) getClass.videoLink = url getClass.videoType = videoType urlList = getClass.chaseUrl() if urlList['stat'] == 0 : print("stat is zero") self.fileList = urlList['msg'] i = 1 for x in urlList['msg']: result += '第' + str(i) + '段:\n' + str(x) + '\n' print("result is "+result) i += 1 else : result = urlList['msg'] else : result = '链接地址不再分析范围内!'
def __getUrl(self): url = self.urlInput.get() result = True if 'youku' in url: getClass = youkuClass.ChaseYouku() elif 'sohu' in url: getClass = sohuClass.ChaseSohu() elif 'letv' in url: getClass = letvClass.ChaseLetv() elif 'tudou' in url: getClass = tudouClass.ChaseTudou() getClass.videoLink = url url = getClass.chaseUrl() getClass = youkuClass.ChaseYouku() elif 'bilibili' in url: getClass = bilibiliClass.ChaseBilibili() elif 'acfun' in url: getClass = acfunClass.ChaseAcfun() elif 'iqiyi' in url: getClass = iqiyiClass.ChaseIqiyi() else: result = False if result: result = '' videoType = self.selectorVal.get() if videoType == u'HD': videoType = 's' elif videoType == u'超清': videoType = 'h' elif videoType == u'高清': videoType = 'n' else: videoType = 's' getClass.videoLink = url getClass.videoType = videoType urlList = getClass.chaseUrl() if urlList['stat'] == 0: self.fileList = urlList['msg'] i = 1 for x in urlList['msg']: result += '第' + str(i) + '段:\n' + str(x) + '\n' i += 1 else: result = urlList['msg'] else: result = '链接地址不再分析范围内!' self.resultWindow.insert('end', result) self.__searchBtn()
def __getUrl (self) : url = self.initUrl.get() print("wenfeng url is "+url) #url = "http://v.youku.com/v_show/id_XMjY5MDIxMjMyOA==.html?f=49430238&spm=a2hww.20023042.m_223465.5~5~5~5!3~5~5~A&from=y1.3-idx-beta-1519-23042.223465.7-1" result = True if 'youku' in url : getClass = youkuClass.ChaseYouku() elif 'sohu' in url : getClass = sohuClass.ChaseSohu() elif 'letv' in url : getClass = letvClass.ChaseLetv() elif 'tudou' in url : getClass = tudouClass.ChaseTudou() getClass.videoLink = url url = getClass.chaseUrl() getClass = youkuClass.ChaseYouku() elif 'bilibili' in url : getClass = bilibiliClass.ChaseBilibili() elif 'acfun' in url : getClass = acfunClass.ChaseAcfun() elif 'iqiyi' in url : getClass = iqiyiClass.ChaseIqiyi() else : result = False if result : result = '' #videoType = self.selectorVal.get() videoType = '高清' if videoType == u'HD' : videoType = 's' elif videoType == u'超清' : videoType = 'h' elif videoType == u'高清' : videoType = 'n' else : videoType = 's' getClass.videoLink = url getClass.videoType = videoType urlList = getClass.chaseUrl() if urlList['stat'] == 0 : self.fileList = urlList['msg'] i = 1 for x in urlList['msg']: result += '第' + str(i) + '段:\n' + str(x) + '\n' i += 1 else : result = urlList['msg'] else : result = '链接地址不再分析范围内!'
def get_parser(url): if 'youku' in url: getClass = youkuClass.ChaseYouku() elif 'sohu' in url: getClass = sohuClass.ChaseSohu() elif 'letv' in url: getClass = letvClass.ChaseLetv() elif 'tudou' in url and 'acfun' not in url: getClass = tudouClass.ChaseTudou() elif 'bilibili' in url: getClass = bilibiliClass.ChaseBilibili() elif 'acfun' in url: getClass = acfunClass.ChaseAcfun() elif 'iqiyi' in url: getClass = iqiyiClass.ChaseIqiyi() else: raise NotImplementedError(url) return getClass