def show_root_menu(): ''' Show the plugin root menu. ''' #name = FIRST_SUBMENU #keyboard = xbmc.Keyboard('','请输入搜索内容') keyboard = Keyboard('','请输入搜索内容') keyboard.doModal() keyword = '' if (keyboard.isConfirmed()): keyword = keyboard.getText() #keyword = keyword.replace(' ','%20') keyword = urllib.quote(keyword) url = "http://so.v.360.cn/index.php?kw="+keyword print url link = GetHttpData(url) soup1 = BeautifulSoup(link) soup2=soup1.find(attrs={"data-logger":"hidstat=0"}) if soup2: soup3=soup2.findAll(attrs={"class":"le-figure le-figure-horizontal item-longvideo clearfix"}) for item in soup3: atag=item.a aimg=atag.img url0=atag['href'].encode('utf-8') name=atag['title'].encode('utf-8') img=aimg['src'].encode('utf-8') #print url submenuname = name addDirectoryItem(name, parameters={ PARAMETER_KEY_MODE: MODE_FIRST,"url":url0,"name":submenuname }, isFolder=True, thumbnail=img) #addDirectoryItem(name=SECOND_SUBMENU, parameters={ PARAMETER_KEY_MODE: MODE_SECOND }, isFolder=True) addDirectoryItem("显示相关视频", parameters={ PARAMETER_KEY_MODE: MODE_RELATION,"url":url }, isFolder=True) xbmcplugin.endOfDirectory(handle=handle, succeeded=True)
def input_keyword(): keyboard = Keyboard('', '请输入搜索内容') xbmc.sleep(1500) keyboard.doModal() if (keyboard.isConfirmed()): keyword = keyboard.getText() url = plugin.url_for("search_title", title=keyword) plugin.redirect(url)
def input_keyword(): keyboard = Keyboard('', 'Please Input Keyword') xbmc.sleep(1500) keyboard.doModal() if (keyboard.isConfirmed()): keyword = keyboard.getText() url = plugin.url_for("movie_list", params=keyword) plugin.redirect(url)
def searchLetv(): result='' keyboard = Apps('','请输入搜索内容') # keyboard.setHiddenInput(hidden) xbmc.sleep( 1500 ) keyboard.doModal() if (keyboard.isConfirmed()): keyword = keyboard.getText() letvSearchList(keyword, '1') else: return
def input_title(): keyboard = Keyboard('', 'Please Input Title') xbmc.sleep(1500) keyboard.doModal() if (keyboard.isConfirmed()): keyword = keyboard.getText() if keyword: video_list = get_title_search_db(keyword) for video in video_list: item = set_video_item(video) yield item
def searchvideo(): """ search video """ kb = Keyboard('', u'请输入搜索关键字') kb.doModal() if not kb.isConfirmed(): return sstr = kb.getText() if not sstr: return url = '/index.php?mod=content&action=search&keyword=' keyword = urllib2.quote(sstr.decode('utf-8').encode('gbk')) return showlist(url+keyword)
def searchvideo(): """ search video """ kb = Keyboard('', u'请输入搜索关键字') kb.doModal() if not kb.isConfirmed(): return sstr = kb.getText() if not sstr: return keyword = urllib2.quote(sstr.decode('utf8').encode('gbk')) url = '/index.php/content/search/?keyword='+keyword+'&type=all' return showlist(url)
def searchvideo(): """ search video """ kb = Keyboard('', u'请输入搜索关键字') kb.doModal() if not kb.isConfirmed(): return sstr = kb.getText() if not sstr: return keyword = urllib2.quote(sstr.decode('utf8').encode('gbk')) url = '/index.php/content/search/?keyword=' + keyword + '&type=all' return showlist(url)
def show_root_menu(): ''' Show the plugin root menu. ''' #name = FIRST_SUBMENU #keyboard = xbmc.Keyboard('','请输入搜索内容') keyboard = Keyboard('', '请输入搜索内容') keyboard.doModal() keyword = '' if (keyboard.isConfirmed()): keyword = keyboard.getText() #keyword = keyword.replace(' ','%20') keyword = urllib.quote(keyword) url = "http://so.v.360.cn/index.php?kw=" + keyword print url link = GetHttpData(url) soup1 = BeautifulSoup(link) soup2 = soup1.find(attrs={"data-logger": "hidstat=0"}) if soup2: soup3 = soup2.findAll(attrs={ "class": "le-figure le-figure-horizontal item-longvideo clearfix" }) for item in soup3: atag = item.a aimg = atag.img url0 = atag['href'].encode('utf-8') name = atag['title'].encode('utf-8') img = aimg['src'].encode('utf-8') #print url submenuname = name addDirectoryItem(name, parameters={ PARAMETER_KEY_MODE: MODE_FIRST, "url": url0, "name": submenuname }, isFolder=True, thumbnail=img) #addDirectoryItem(name=SECOND_SUBMENU, parameters={ PARAMETER_KEY_MODE: MODE_SECOND }, isFolder=True) addDirectoryItem("显示相关视频", parameters={ PARAMETER_KEY_MODE: MODE_RELATION, "url": url }, isFolder=True) xbmcplugin.endOfDirectory(handle=handle, succeeded=True)
def searchvideo(): """ search video """ kb = Keyboard('',u'请输入AV号(不包括AV两字)') kb.doModal() if not kb.isConfirmed(): return sstr = kb.getText() if not sstr: return dir_list = [] for item in bili.get_video_list(sstr): try: dir_list.append({ 'label': item[0], 'path': plugin.url_for('play_video', url=item[1], by_list = 0, show_comments=1), }) except: dir_list.append({ 'label': item[0].decode('utf8'), 'path': plugin.url_for('play_video', url=item[1], by_list = 0, show_comments=1), }) try: dir_list.append({ 'label': item[0] + u'(无弹幕)', 'path': plugin.url_for('play_video', url=item[1], by_list = 0, show_comments=0), }) except: dir_list.append({ 'label': item[0].decode('utf8') + u'(无弹幕)', 'path': plugin.url_for('play_video', url=item[1], by_list = 0, show_comments=0), }) try: dir_list.append({ 'label': item[0] + u'(分段无弹幕)', 'path': plugin.url_for('play_video', url=item[1], by_list = 1, show_comments=0), }) except: dir_list.append({ 'label': item[0].decode('utf8') + u'(分段无弹幕)', 'path': plugin.url_for('play_video', url=item[1], by_list = 1, show_comments=0), }) return dir_list
def courseLists(url): """ scratch course list """ if url == 'search': url = 'http://so.open.163.com/movie/search/searchprogram/ot0/tacy/1.html?vs=' kb = Keyboard('',u'请输入搜索关键字') kb.doModal() if kb.isConfirmed(): searchStr = kb.getText() searchStr2 = unicode(searchStr, 'utf-8') url = url + urllib2.quote(searchStr2.encode('gb18030')) print url soup = _http(url) courseDiv = soup.find('div', {'class': 'contentArea-tabContent on'}) courseUl = courseDiv.find('ul', {'class': 'contentArea-resultList'}) pageList = courseDiv.find('div', {'class': 'page'}) courseList = courseUl.findAll('a', {'class': None}) item = [] rePatten = re.compile(r'href="(.*?)".*?>([^<\n].*?)<', re.DOTALL) for tmp in courseList: urllist = re.search(rePatten, str(tmp)) if urllist: # print urlGroup.group(1) + urlGroup.group(2) item.append({ 'label': urllist.group(2), 'path': plugin.url_for('courseInfos', url=urllist.group(1)), }) rePatten = re.compile(r'href="(.*?)">(\D.*?)</a>') pageGroup = re.findall(rePatten, str(pageList)) for pg in pageGroup: tmp = unicode(pg[1], 'utf-8') if tmp==u'上一页': item.insert(0, {'label': u'上一页', 'path': plugin.url_for('courseLists', url=pg[0]),}) if tmp==u'下一页': item.append({'label': u'下一页', 'path': plugin.url_for('courseLists', url=pg[0]),}) return item
def searchvideo(url): """ search video """ source = [('http://v.youku.com', 'youku'), ('http://tv.sohu.com', 'sohu'), ('http://v.qq.com', 'qq'), ('http://www.iqiyi.com', 'iqiyi'), ('http://www.letv.com', 'letv'), ('http://v.pps.tv', 'pps'), ('http://www.tudou.com', 'tudou')] kb = Keyboard('', u'请输入搜索关键字') kb.doModal() if not kb.isConfirmed(): return sstr = kb.getText() if not sstr: return url = url + urllib2.quote(sstr) result = _http(url) movstr = re.findall(r'<div class="item">(.*?)<!--item end-->', result, re.S) vitempat = re.compile( r'{0}{1}'.format('p_link">.*?title="(.*?)".*?p_thumb.*?src="(.*?)"', '.*?status="(.*?)"'), re.S) menus = [] site = None for movitem in movstr: if 'p_ispaid' in movitem or 'nosource' in movitem: continue psrc = re.compile(r'pgm-source(.*?)</div>', re.S).search(movitem) if not psrc: continue for k in source: if k[0] in psrc.group(1): site = k break if not site: continue vitem = vitempat.search(movitem) if 'class="movie"' in movitem: eps = re.search(r'(%s.*?html)' % site[0], movitem, re.S).group(1) menus.append({ 'label': '%s【%s】(%s)' % (vitem.group(1), vitem.group(3), site[1]), 'path': plugin.url_for('playsearch', url=eps, source=site[1]), 'thumbnail': vitem.group(2), }) if 'class="tv"' in movitem or 'class="zy"' in movitem: if 'class="tv"' in movitem: epss = re.findall(r'(%s.*?html).*?>([\w ."]+?)</a>' % site[0], movitem, re.S) else: epss = re.findall( r'{0}{1}{2}'.format( '"(?:(?:date)|(?:phases))">([\d-]+)</span>\s+<a[\S ]+(', site[0], '.*?html).*?>([^>]+?)<(?:(?:em)|(?:/a))(?s)'), movitem) epss = [(i[1], '[%s]%s' % (i[0], i[2])) for i in epss] #epss = reversed([(k, v) for k,v in OrderedDict(reversed(epss)). # iteritems() if '查看全部' not in v]) epss = [(v[0], site[1], v[1]) for v in epss] menus.append({ 'label': '%s【%s】(%s)' % (vitem.group(1), vitem.group(3), site[1]), 'path': plugin.url_for('showsearch', url=str(epss)), 'thumbnail': vitem.group(2), }) return menus
def searchvideo(url): """ search video """ source = [ ("http://v.youku.com", "youku"), ("http://tv.sohu.com", "sohu"), ("http://v.qq.com", "qq"), ("http://www.iqiyi.com", "iqiyi"), ("http://www.letv.com", "letv"), ("http://v.pps.tv", "pps"), ("http://www.tudou.com", "tudou"), ] kb = Keyboard("", u"请输入搜索关键字") kb.doModal() if not kb.isConfirmed(): return sstr = kb.getText() if not sstr: return url = url + urllib2.quote(sstr) result = _http(url) movstr = re.findall(r'<div class="item">(.*?)<!--item end-->', result, re.S) vitempat = re.compile( r"{0}{1}".format('p_link">.*?title="(.*?)".*?p_thumb.*?src="(.*?)"', '.*?status="(.*?)"'), re.S ) menus = [] site = None for movitem in movstr: if "p_ispaid" in movitem or "nosource" in movitem: continue psrc = re.compile(r"pgm-source(.*?)</div>", re.S).search(movitem) if not psrc: continue for k in source: if k[0] in psrc.group(1): site = k break if not site: continue vitem = vitempat.search(movitem) if 'class="movie"' in movitem: eps = re.search(r"(%s.*?html)" % site[0], movitem, re.S).group(1) menus.append( { "label": "%s【%s】(%s)" % (vitem.group(1), vitem.group(3), site[1]), "path": plugin.url_for("playsearch", url=eps, source=site[1]), "thumbnail": vitem.group(2), } ) if 'class="tv"' in movitem or 'class="zy"' in movitem: if 'class="tv"' in movitem: epss = re.findall(r'(%s.*?html).*?>([\w ."]+?)</a>' % site[0], movitem, re.S) else: epss = re.findall( r"{0}{1}{2}".format( '"(?:(?:date)|(?:phases))">([\d-]+)</span>\s+<a[\S ]+(', site[0], ".*?html).*?>([^>]+?)<(?:(?:em)|(?:/a))(?s)", ), movitem, ) epss = [(i[1], "[%s]%s" % (i[0], i[2])) for i in epss] # epss = reversed([(k, v) for k,v in OrderedDict(reversed(epss)). # iteritems() if '查看全部' not in v]) epss = [(v[0], site[1], v[1]) for v in epss] menus.append( { "label": "%s【%s】(%s)" % (vitem.group(1), vitem.group(3), site[1]), "path": plugin.url_for("showsearch", url=str(epss)), "thumbnail": vitem.group(2), } ) return menus
def searchvideo(url): """ search video """ source = [('http://v.youku.com', 'youku'), ('http://tv.sohu.com', 'sohu'), ('http://v.qq.com', 'qq'), ('http://www.iqiyi.com', 'iqiyi'), ('http://www.letv.com', 'letv'), ('http://v.pps.tv', 'pps'), ('http://www.tudou.com', 'tudou')] kb = Keyboard('','请输入搜索关键字') kb.doModal() if not kb.isConfirmed(): return sstr = kb.getText() if not sstr: return url = url + urllib.parse.quote(sstr) result = _http(url) movstr = re.findall(r'<div class="item">(.*?)<!--item end-->', result, re.S) vitempat = re.compile( r'{0}{1}'.format('p_link">.*?title="(.*?)".*?p_thumb.*?src="(.*?)"', '.*?status="(.*?)"'), re.S) menus = [] site = None for movitem in movstr: if 'p_ispaid' in movitem or 'nosource' in movitem: continue psrc = re.compile(r'pgm-source(.*?)</div>', re.S).search(movitem) if not psrc: continue for k in source: if k[0] in psrc.group(1): site = k break if not site: continue vitem = vitempat.search(movitem) if 'class="movie"' in movitem: eps = re.search(r'(%s.*?html)' % site[0], movitem, re.S).group(1) menus.append({ 'label': '%s【%s】(%s)' % ( vitem.group(1), vitem.group(3), site[1]), 'path': plugin.url_for('playsearch', url=eps, source=site[1]), 'thumbnail': vitem.group(2),}) if 'class="tv"' in movitem or 'class="zy"' in movitem: if 'class="tv"' in movitem: epss = re.findall( r'(%s.*?html).*?>([\w ."]+?)</a>' % site[0], movitem, re.S) else: epss = re.findall(r'{0}{1}{2}'.format( '"(?:(?:date)|(?:phases))">([\d-]+)</span>\s+<a[\S ]+(', site[0], '.*?html).*?>([^>]+?)<(?:(?:em)|(?:/a))(?s)'), movitem) epss = [(i[1], '[%s]%s' % (i[0], i[2])) for i in epss] #epss = reversed([(k, v) for k,v in OrderedDict(reversed(epss)). # iteritems() if '查看全部' not in v]) epss = [(v[0], site[1], v[1]) for v in epss] menus.append({ 'label': '%s【%s】(%s)' % ( vitem.group(1), vitem.group(3), site[1]), 'path': plugin.url_for('showsearch', url=str(epss)), 'thumbnail': vitem.group(2),}) return menus