Beispiel #1
0
def search_collection(category):
    kb = Keyboard('', translation(32106))
    kb.doModal()
    if (kb.isConfirmed()):
        text = kb.getText().strip()
    else:
        return
    
    return show_collection(text,category)
Beispiel #2
0
def search(query = '', page_number = 1):
    import urllib
    if query:
        query = urllib.quote_plus(query)
    else:
        from xbmc import Keyboard
        keyboard = Keyboard('', 'Nach Video suchen')
        keyboard.doModal()
        if keyboard.isConfirmed():
            query = urllib.quote_plus(keyboard.getText())
        else: return
    url = '%s%s%s' % (MAIN_API_URL, 'search?access_token=true&page=%i&per_page=%i&q=' % (page_number, MAX_PER_PAGE), query)
    list_videos(url)
Beispiel #3
0
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
Beispiel #4
0
 def search(self):
     if "keyword" not in self._params:
         kb = Keyboard('', 'Please input Movie or TV Shows name 请输入想要观看的电影或电视剧名称')
         kb.doModal()
         if not kb.isConfirmed(): return
         sstr = kb.getText()
         if not sstr: return
         self.add_search_history(sstr)
     else:
         sstr = self._params["keyword"]
     inputMovieName=urllib.quote_plus(sstr)
         
     urlSearch = self._baseUrl + '/index.php?m=vod-search'
     data = 'wd='+inputMovieName
     req = urllib2.Request(urlSearch, data, self._header)
     searchResponse = self._opener.open(req).read()
     
     searchReg = r'<h6 class="fl">.*?<a href="(.*?)".*?>(.*?)</a>'
     searchResult = utils.parse(searchResponse, searchReg)
     
     listitem = xbmcgui.ListItem('[COLOR FFFF00FF]Search result 当前搜索: [/COLOR][COLOR FFFFFF00]('+sstr+') [/COLOR][COLOR FF00FFFF] Total 共计:'+str(len(searchResult))+'[/COLOR]【[COLOR FF00FF00]'+'Click here for new search 点此输入新搜索内容'+'[/COLOR]】')
     xbmcplugin.addDirectoryItem(self._handle, self.gen_plugin_url({"act": "search"}), listitem, True)
     for i in searchResult:
         listitem = xbmcgui.ListItem(i[1])
         url = self.gen_plugin_url({"act": "detail",
                                  "url": i[0],
                                  "title": i[1]})
         xbmcplugin.addDirectoryItem(self._handle, url, listitem, True)
     xbmcplugin.endOfDirectory(self._handle)
 def search(self):
     if "keyword" not in self._params:
         kb = Keyboard('', 'Please input Movie or TV Shows name 请输入想要观看的电影或电视剧名称')
         kb.doModal()
         if not kb.isConfirmed(): return
         sstr = kb.getText()
         if not sstr: return
         self.add_search_history(sstr)
     else:
         sstr = self._params["keyword"]
     inputMovieName=urllib.quote_plus(sstr)
         
     urlSearch = self._baseUrl + '/index.php?m=vod-search-'
     urlSearch += 'wd-'+inputMovieName
     print urlSearch
     req = urllib2.Request(urlSearch, None, self._header)
     searchResponse = self._opener.open(req).read()
     #searchReg = r'<h6 class="fl"> <a href="(.*?)".*?>(.*?)</a>'
     searchReg = r'<li class="p1 m1"><a class="link-hover" href="(.*?)" title="(.*?)"><img class="lazy" data-original="(.*?)" src=".*?" alt="(.*?)">'
     searchResult = utils.parse(searchResponse, searchReg)
     
     listitem = xbmcgui.ListItem('[COLOR FFFF00FF]Search result 当前搜索: [/COLOR][COLOR FFFFFF00]('+sstr+') [/COLOR][COLOR FF00FFFF] Total 共计:'+str(len(searchResult))+'[/COLOR]【[COLOR FF00FF00]'+'Click here for new search 点此输入新搜索内容'+'[/COLOR]】')
     xbmcplugin.addDirectoryItem(self._handle, self.gen_plugin_url({"act": "search"}), listitem, True)
     for item in searchResult:
         title = item[1]
         listitem = xbmcgui.ListItem(title, thumbnailImage=self._baseUrl + item[2])
         url = self.gen_plugin_url({"act": "detail",
                                  "url": item[0],
                                  "title": title})
         xbmcplugin.addDirectoryItem(self._handle, url, listitem, True)
     xbmcplugin.endOfDirectory(self._handle)
Beispiel #6
0
def tastaturEingabe() -> str:
    keyb = Keyboard()
    keyb.doModal()
    if keyb.isConfirmed():
        return keyb.getText()
    else:
        return ''
Beispiel #7
0
    def search(self):
        if "keyword" not in self._params:
            kb = Keyboard('', 'Please input Movie or TV Shows name 请输入想要观看的电影或电视剧名称')
            kb.doModal()
            if not kb.isConfirmed(): return
            sstr = kb.getText()
            if not sstr: return
            self.add_search_history(sstr)
        else:
            sstr = self._params["keyword"]
        inputMovieName=urllib.quote_plus(sstr)
        #https://www.newcyy.com/search.php?searchword=
        urlSearch = self._baseUrl + '/search.php?searchword='+inputMovieName
        print urlSearch
        req = urllib2.Request(urlSearch, None, self._header)
        searchResponse = self._opener.open(req).read()
        #print searchResponse
        reg = r'<li class="i_list list_n2"><a href="(.*?)" target="_blank"><img class="waitpic" src=".*?" data-original="(.*?)" alt="(.*?)".*?></a>'
        searchResult = utils.parse(searchResponse, reg)
        
        listitem = xbmcgui.ListItem('[COLOR FFFF00FF]Search result 当前搜索: [/COLOR][COLOR FFFFFF00]('+sstr+') [/COLOR][COLOR FF00FFFF] Total 共计:'+str(len(searchResult))+'[/COLOR]【[COLOR FF00FF00]'+'Click here for new search 点此输入新搜索内容'+'[/COLOR]】')
        xbmcplugin.addDirectoryItem(self._handle, self.gen_plugin_url({"act": "search"}), listitem, True)
        for item in searchResult:
            title = item[2]
            imageUrl = item[1]
            if not imageUrl.startswith("http"):
                imageUrl = self._baseUrl + imageUrl

            listitem = xbmcgui.ListItem(title, thumbnailImage=imageUrl)
            url = self.gen_plugin_url({"act": "detail",
                                     "url": item[0],
                                     "title": title})
            xbmcplugin.addDirectoryItem(self._handle, url, listitem, True)
        xbmcplugin.endOfDirectory(self._handle)
Beispiel #8
0
def createListForSelectedVideo():
    def extractVideoID(url):
        _id = url  # http://twitch.tv/a/v/12345678?t=9m1s
        # http://twitch.tv/videos/12345678?t=9m1s
        idx = _id.find('?')
        if idx >= 0:
            _id = _id[:idx]  # https://twitch.tv/a/v/12345678
        idx = _id.rfind('/')
        if idx >= 0:
            _id = _id[:idx] + _id[idx + 1:]  # https://twitch.tv/a/v12345678
        idx = _id.rfind('/')
        if idx >= 0:
            _id = _id[idx + 1:]  # v12345678
        if _id.startswith("videos"):  # videos12345678
            _id = "v" + _id[6:]  # v12345678

        return _id

    items = []
    keyboard = Keyboard('')
    keyboard.doModal()
    if keyboard.isConfirmed():
        _id = extractVideoID(keyboard.getText())
        if _id:
            video = TWITCHTV.getVideo(_id)
            items = [CONVERTER.convertVideoListToListItem(video)]
    return items
def createListForSelectedVideo():
    def extractVideoID(url):
        _id = url                         # http://twitch.tv/a/v/12345678?t=9m1s
        idx = _id.find('?')
        if idx >= 0:
            _id = _id[:idx]               # https://twitch.tv/a/v/12345678
        idx = _id.rfind('/')
        if idx >= 0:
            _id = _id[:idx] + _id[idx+1:] # https://twitch.tv/a/v12345678
        idx = _id.rfind('/')
        if idx >= 0:
            _id = _id[idx+1:]             # v12345678
        return _id

    items = []
    keyboard = Keyboard('')
    keyboard.doModal()
    if keyboard.isConfirmed():
        _id = extractVideoID(keyboard.getText())
        if _id:
            video = TWITCHTV.getVideo(_id)
            items = [CONVERTER.convertVideoListToListItem(video)]
    return items
Beispiel #10
0
def search_collection(category):
    kb = Keyboard('', translation(32106))
    kb.doModal()
    if (kb.isConfirmed()):
        text = kb.getText().strip()
    else:
        return

    return show_collection(text, category)
    def search(self):
        if "keyword" not in self._params:
            kb = Keyboard(
                '', 'Please input Movie or TV Shows name 请输入想要观看的电影或电视剧名称')
            kb.doModal()
            if not kb.isConfirmed(): return
            sstr = kb.getText()
            if not sstr: return
            self.add_search_history(sstr)
        else:
            sstr = self._params["keyword"]
        inputMovieName = urllib.quote_plus(sstr)

        #http://jiqimao.tv/search/video/%E4%B8%89%E5%9B%BD
        urlSearch = self._baseUrl + '/search/video/' + inputMovieName
        print urlSearch
        req = urllib2.Request(urlSearch, None, self._header)
        searchResponse = self._opener.open(req).read()
        #print searchResponse
        # <a href="http://jiqimao.tv/movie/show/b1ddfe43fe64adcac286546ade2d1e28a2313448" target="_blank">
        #     <div class="search-tv-box">
        #         <img class="search-tv-img" src="http://tupian.tupianzy.com/pic/upload/vod/2018-03-28/201803281522238464.jpg" alt="三国机密之潜龙在渊" onerror="loadDefaultMid();">
        #         <div class="search-tv-title">
        #             三国机密之潜龙在渊
        #         </div>
        #         <div class="search-tv-pa-type">
        #             电视剧
        #         </div>
        #         <div class="search-tv-pa-episode">
        #             共54集
        #         </div>
        #     </div>
        # </a>
        searchReg = r'<a href="([-a-zA-Z0-9@:%_\+.~#?&//=]*?)" target="_blank">\s*?<div class="search-tv-box">\s*?<img class="search-tv-img" src="(.*?)" alt="(.*?)".*?>'
        searchResult = utils.parse(searchResponse, searchReg)
        #print searchResult

        listitem = xbmcgui.ListItem(
            '[COLOR FFFF00FF]Search result 当前搜索: [/COLOR][COLOR FFFFFF00](' +
            sstr + ') [/COLOR][COLOR FF00FFFF] Total 共计:' +
            str(len(searchResult)) + '[/COLOR]【[COLOR FF00FF00]' +
            'Click here for new search 点此输入新搜索内容' + '[/COLOR]】')
        xbmcplugin.addDirectoryItem(self._handle,
                                    self.gen_plugin_url({"act": "search"}),
                                    listitem, True)
        for item in searchResult:
            title = item[2]
            listitem = xbmcgui.ListItem(title,
                                        thumbnailImage=self.get_full_url(
                                            item[1]))
            url = self.gen_plugin_url({
                "act": "detail",
                "url": item[0],
                "title": title
            })
            xbmcplugin.addDirectoryItem(self._handle, url, listitem, True)
        xbmcplugin.endOfDirectory(self._handle)
Beispiel #12
0
def genericList():
    InternalDatabase.connect()
    if "/search.html" == plugin.path and "keyword" not in plugin.query:
        keyboard = Keyboard()
        keyboard.doModal()

        if keyboard.isConfirmed():
            keyword = keyboard.getText()
            response = request(plugin.pathqs + '&keyword=' + keyword)
        else:
            return
    else:
        response = request(plugin.pathqs)

    pageNum = int(plugin.query['page'][0])
    document = BeautifulSoup(response.text,
                             'html.parser').find('div', class_="last_episodes")
    items = []
    for li in document.find_all('li'):
        a = li.find('a')
        path = a['href'].encode('utf-8')
        anime = get_anime_detail(path)
        # item = ListItem(a['title'].encode('utf-8').strip())
        # item.setArt({'poster': a.find('img')['src']})
        # item.setInfo("video", {'year': int(li.find('p', class_="released").string.strip()[-4:])})
        item = ListItem(anime['title'])
        item.setArt({'poster': anime.pop('poster')})
        item.setInfo("video", anime)
        items.append((plugin.url_for(path), item, True))

    item = ListItem("Next >>")
    if "/search.html" == plugin.path:
        if "keyword" in plugin.query:
            items.append(
                (plugin.url_for(plugin.path + "?page=" + str(pageNum + 1) +
                                '&keyword=' + plugin.query['keyword'][0]),
                 item, True))
        else:
            items.append(
                (plugin.url_for(plugin.path + "?page=" + str(pageNum + 1) +
                                '&keyword=' + keyword), item, True))
    else:
        items.append(
            (plugin.url_for(plugin.path + "?page=" + str(pageNum + 1)), item,
             True))
    if pageNum != 1:
        item = ListItem("Back to main page")
        items.append((plugin.url_for("/"), item, True))

    InternalDatabase.close()
    xbmcplugin.setContent(plugin.handle, 'videos')
    xbmcplugin.addDirectoryItems(plugin.handle, items, len(items))
    xbmcplugin.endOfDirectory(plugin.handle)
Beispiel #13
0
def search(query='', page_number=1):
    import urllib
    if query:
        query = urllib.quote_plus(query)
    else:
        from xbmc import Keyboard
        keyboard = Keyboard('', 'Nach Video suchen')
        keyboard.doModal()
        if keyboard.isConfirmed():
            query = urllib.quote_plus(keyboard.getText())
        else:
            return
    url = '%s%s%s' % (MAIN_API_URL,
                      'search?access_token=true&page=%i&per_page=%i&q=' %
                      (page_number, MAX_PER_PAGE), query)
    list_videos(url)
Beispiel #14
0
def Search():
    kb = Keyboard('',u'Please input Movie or TV Shows name 请输入想要观看的电影或电视剧名称')
    kb.doModal()
    if not kb.isConfirmed(): return
    sstr = kb.getText()
    if not sstr: return
    inputMovieName=urllib.quote_plus(sstr)
    urlSearch = 'http://www.dnvod.eu/Movie/Search.aspx?tags='+inputMovieName
    searchRequest = urllib2.Request(urlSearch,None,headers)
    searchResponse = urllib2.urlopen(searchRequest)
    searchdataResponse = searchResponse.read()
    searchReg = r'<a href="(.*%3d)">'
    searchPattern = re.compile(searchReg)
    searchResult = searchPattern.findall(searchdataResponse)

    fo = open(rootDir+"/searchResult.txt", "w")
    for node in searchResult:
        fo.write(str(node)+'\n')
    fo.close



    searchRegName = r'3d" title="(.*)">'
    searchPatternName = re.compile(searchRegName)
    searchResultName = searchPatternName.findall(searchdataResponse)

    fo = open(rootDir+"/searchResultName.txt", "w")
    for node in searchResultName:
        fo.write(str(node)+'\n')
    fo.close

    listitem = xbmcgui.ListItem('[COLOR FFFF00FF]Search result 当前搜索: [/COLOR][COLOR FFFFFF00]('+sstr+') [/COLOR][COLOR FF00FFFF] Total 共计:'+str(len(searchResult))+'[/COLOR]【[COLOR FF00FF00]'+'Click here for new search 点此输入新搜索内容'+'[/COLOR]】')
    url=sys.argv[0]+'?act=Search&name'+inputMovieName
    xbmcplugin.addDirectoryItem(handle, url, listitem, True)
    for i in range(len(searchResultName)):
        listitem = xbmcgui.ListItem(searchResultName[i])
        url=sys.argv[0]+'?act=Searchr&id='+str(i+1)
        xbmcplugin.addDirectoryItem(handle, url, listitem, True)
        print str(i+1)+': '+searchResultName[i]+'\n'
    xbmcplugin.endOfDirectory(handle)
Beispiel #15
0
    def search(self):
        if "keyword" not in self._params:
            kb = Keyboard('',u'Please input Movie or TV Shows name 请输入想要观看的电影或电视剧名称')
            kb.doModal()
            if not kb.isConfirmed(): return
            sstr = kb.getText()
            if not sstr: return
            self.add_search_history(sstr)
        else:
            sstr = self._params["keyword"]
        if not sstr: return
        inputMovieName=urllib.quote_plus(sstr)        
        #headers['Referer']='http://www.dnvod.tv/'
        urlSearch = 'http://www.dnvod.tv/Movie/Search.aspx?tags='+inputMovieName
        print urlSearch
        home = urllib2.Request(self._baseUrl, None, self._header)
        self._opener.open(home)
        searchRequest = urllib2.Request(urlSearch,None, self._header)
        searchResponse = self._opener.open(searchRequest)
        searchdataResponse = searchResponse.read()
        print searchdataResponse
        searchReg = r'<a href="(.*%3d)">'
        searchPattern = re.compile(searchReg)
        urls = searchPattern.findall(searchdataResponse)

        searchRegName = r'3d" title="(.*)">'
        searchPatternName = re.compile(searchRegName)
        searchResultName = searchPatternName.findall(searchdataResponse)
        
        listitem = xbmcgui.ListItem('[COLOR FFFF00FF]Search result 当前搜索: [/COLOR][COLOR FFFFFF00]('+sstr+') [/COLOR][COLOR FF00FFFF] Total 共计:'+str(len(urls))+'[/COLOR]【[COLOR FF00FF00]'+'Click here for new search 点此输入新搜索内容'+'[/COLOR]】')
        url= self.gen_plugin_url({"act": "search"})
        xbmcplugin.addDirectoryItem(self._handle, url, listitem, True)
        for i in range(len(searchResultName)):
            listitem = xbmcgui.ListItem(searchResultName[i])
            url=self.gen_plugin_url({"act": "detail", "title": searchResultName[i],
                                     "url": urls[i]})
            xbmcplugin.addDirectoryItem(self._handle, url, listitem, True)
            print str(i+1)+': '+searchResultName[i]+'\n'
        xbmcplugin.endOfDirectory(self._handle)
Beispiel #16
0
 def search(self):
     if "keyword" not in self._params:
         kb = Keyboard('', 'Please input Movie or TV Shows name 请输入想要观看的电影或电视剧名称')
         kb.doModal()
         if not kb.isConfirmed(): return
         sstr = kb.getText()
         if not sstr: return
         self.add_search_history(sstr)
     else:
         sstr = self._params["keyword"]
     inputMovieName=urllib.quote_plus(sstr)
         
     #http://jiqimao.tv/search/video/%E4%B8%89%E5%9B%BD    
     urlSearch = self._baseUrl + '/v1/search?q=' + inputMovieName
     print urlSearch
     req = urllib2.Request(urlSearch, None, self._header)
     searchResponse = self._opener.open(req).read()
     
     print searchResponse
     movie_list = json.loads(searchResponse)
     print movie_list
     
     #print searchResult
     
     listitem = xbmcgui.ListItem('[COLOR FFFF00FF]Search result 当前搜索: [/COLOR][COLOR FFFFFF00]('+sstr+') [/COLOR][COLOR FF00FFFF] Total 共计:'+str(len(movie_list))+'[/COLOR]【[COLOR FF00FF00]'+'Click here for new search 点此输入新搜索内容'+'[/COLOR]】')
     xbmcplugin.addDirectoryItem(self._handle, self.gen_plugin_url({"act": "search"}), listitem, True)
     for item in movie_list:
         title = item["name"].encode("utf-8")
         movie_url = self._baseUrl + "/show/" + urllib.quote(item["slug"].encode("utf-8"))
         print(title, movie_url)
         listitem = xbmcgui.ListItem(title, thumbnailImage=self.get_full_url(item["thumb"]))
         url = self.gen_plugin_url({"act": "detail",
                                    "url": movie_url,
                                    "title": title})
         xbmcplugin.addDirectoryItem(self._handle, url, listitem, True)
     xbmcplugin.endOfDirectory(self._handle)
Beispiel #17
0
def Search():
    global cookie
    global opener
    kb = Keyboard('',u'Please input Movie or TV Shows name 请输入想要观看的电影或电视剧名称')
    kb.doModal()
    if not kb.isConfirmed(): return
    sstr = kb.getText()
    if not sstr: return
    inputMovieName=urllib.quote_plus(sstr)
    if hascookie==False:
        try:
            urlSearch = 'http://www.dnvod.tv/Movie/Search.aspx?tags=a'
            req = urllib2.Request(urlSearch, headers=Searchheaders)
            searchResponse = opener.open(req)
        except urllib2.HTTPError as e:
            error_message=e.read()
        #	print error_message
            detailReg = r'f\, (.*)={\"(.*)\":(.*)\};'
            detailPattern = re.compile(detailReg)
            detailResult = detailPattern.findall(error_message)
            first=detailResult[0][0]+"={\""+detailResult[0][1]+"\":"+detailResult[0][2]+"};"
            varname1=detailResult[0][0]
            varname2=detailResult[0][1]
            detailReg = r'challenge\-form\'\)\;\s*(.*)a.value = (.*)'
            detailPattern = re.compile(detailReg)
            detailResult = detailPattern.findall(error_message)
            second=detailResult[0][0]+"s = parseInt("+varname1+"."+varname2+", 10) + 12; "
            jscode="var s,"+first+second
            result=js2py.eval_js(jscode)
            soup = BeautifulSoup(error_message,"html.parser")
            fparam=soup.find_all('input')[0]['value']
            sparam=soup.find_all('input')[1]['value']
            searchData= urllib.urlencode({
                'jschl_vc': fparam,
                'pass': sparam,
                'jschl_answer': result
                })
            searchUrl = 'http://www.dnvod.tv/cdn-cgi/l/chk_jschl?'+'jschl_vc='+str(fparam)+'&pass='******'&jschl_answer='+str(result)
            try:
                print searchUrl
                headers['Referer']='http://www.dnvod.tv/Movie/Search.aspx?tags=a'
                req = urllib2.Request(searchUrl, headers=Searchheaders)
                time.sleep(5)
                sresult = opener.open(req)
                # print sresult.read()
                print sresult.info()
            except urllib2.HTTPError as e:
                print e.code
                print e.read()
    
    headers['Referer']='http://www.dnvod.tv/'
    urlSearch = 'http://www.dnvod.tv/Movie/Search.aspx?tags='+inputMovieName
    searchRequest = urllib2.Request(urlSearch,None,Searchheaders)
    searchResponse = opener.open(searchRequest)
    searchdataResponse = searchResponse.read()
    searchReg = r'<a href="(.*%3d)">'
    searchPattern = re.compile(searchReg)
    searchResult = searchPattern.findall(searchdataResponse)

    fo = open(rootDir+"/searchResult.txt", "w")
    for node in searchResult:
        fo.write(str(node)+'\n')
    fo.close



    searchRegName = r'3d" title="(.*)">'
    searchPatternName = re.compile(searchRegName)
    searchResultName = searchPatternName.findall(searchdataResponse)

    fo = open(rootDir+"/searchResultName.txt", "w")
    for node in searchResultName:
        fo.write(str(node)+'\n')
    fo.close

    listitem = xbmcgui.ListItem('[COLOR FFFF00FF]Search result 当前搜索: [/COLOR][COLOR FFFFFF00]('+sstr+') [/COLOR][COLOR FF00FFFF] Total 共计:'+str(len(searchResult))+'[/COLOR]【[COLOR FF00FF00]'+'Click here for new search 点此输入新搜索内容'+'[/COLOR]】')
    url=sys.argv[0]+'?act=Search'
    xbmcplugin.addDirectoryItem(handle, url, listitem, True)
    for i in range(len(searchResultName)):
        listitem = xbmcgui.ListItem(searchResultName[i])
        url=sys.argv[0]+'?act=Searchr&id='+str(i+1)
        xbmcplugin.addDirectoryItem(handle, url, listitem, True)
        print str(i+1)+': '+searchResultName[i]+'\n'
    xbmcplugin.endOfDirectory(handle)
Beispiel #18
0
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
Beispiel #19
0
def pagination():
    if plugin.path == '/search' and 'keyword' not in plugin.query:
        keyboard = Keyboard()
        keyboard.doModal()

        if keyboard.isConfirmed():
            response = request(plugin.pathqs + '&keyword=' +
                               keyboard.getText())
        else:
            return
    else:
        response = request(plugin.pathqs)

    document = BeautifulSoup(response.text, 'html.parser').find(
        'ul', {'class': ['list-episode-item', 'list-star']})
    items = []

    if document is not None:
        if plugin.path in ('/list-star.html', '/most-popular-drama',
                           '/search'):
            if plugin.path == '/list-star.html' or ('type' in plugin.query
                                                    and 'stars'
                                                    in plugin.query['type']):
                for li in document.find_all('li', recursive=False):
                    plot = li.find('ul')
                    item = ListItem(li.find('img').attrs['alt'])
                    item.setArt(
                        {'poster': li.find('img').attrs['data-original']})
                    item.setInfo('video',
                                 {'plot': '' if plot is None else plot.text})
                    items.append((plugin.url_for(li.find('a').attrs['href']),
                                  item, True))
            else:
                InternalDatabase.connect()

                for a in document.find_all('a'):
                    path = a.attrs['href']
                    drama = drama_detail(path)
                    item = ListItem(drama['title'])
                    item.setArt({'poster': drama.pop('poster')})
                    item.setInfo('video', drama)
                    items.append((plugin.url_for(path), item, True))

                InternalDatabase.close()
        else:
            for a in document.find_all('a'):
                item = ListItem(u'[{}] {} {}'.format(
                    a.find('span', {
                        'class': 'type'
                    }).text,
                    a.find('h3').text,
                    a.find('span', {
                        'class': 'ep'
                    }).text))
                item.setArt({'poster': a.find('img').attrs['data-original']})
                item.setInfo('video', {})
                item.setProperty('IsPlayable', 'true')
                items.append((plugin.url_for(a.attrs['href']), item, False))

        document = document.find_next_sibling()

        if document is not None:
            for li in document.find_all('li', {'class': ['next', 'previous']}):
                item = ListItem(li.text)
                items.append(
                    (plugin.url_for(plugin.path + li.find('a').attrs['href']),
                     item, True))

    xbmcplugin.setContent(plugin.handle, 'videos')
    xbmcplugin.addDirectoryItems(plugin.handle, items, len(items))
    xbmcplugin.endOfDirectory(plugin.handle)
Beispiel #20
0
def Search():
    global cookie
    global opener
    kb = Keyboard('', u'Please input Movie or TV Shows name 请输入想要观看的电影或电视剧名称')
    kb.doModal()
    if not kb.isConfirmed(): return
    sstr = kb.getText()
    if not sstr: return
    inputMovieName = urllib.quote_plus(sstr)
    if hascookie == False:
        try:
            urlSearch = 'http://www.dnvod.tv/Movie/Search.aspx?tags=a'
            req = urllib2.Request(urlSearch, headers=Searchheaders)
            searchResponse = opener.open(req)
        except urllib2.HTTPError as e:
            error_message = e.read()
            #	print error_message
            detailReg = r'f\, (.*)={\"(.*)\":(.*)\};'
            detailPattern = re.compile(detailReg)
            detailResult = detailPattern.findall(error_message)
            first = detailResult[0][0] + "={\"" + detailResult[0][
                1] + "\":" + detailResult[0][2] + "};"
            varname1 = detailResult[0][0]
            varname2 = detailResult[0][1]
            detailReg = r'challenge\-form\'\)\;\s*(.*)a.value = (.*)'
            detailPattern = re.compile(detailReg)
            detailResult = detailPattern.findall(error_message)
            second = detailResult[0][
                0] + "s = parseInt(" + varname1 + "." + varname2 + ", 10) + 12; "
            jscode = "var s," + first + second
            result = js2py.eval_js(jscode)
            soup = BeautifulSoup(error_message, "html.parser")
            fparam = soup.find_all('input')[0]['value']
            sparam = soup.find_all('input')[1]['value']
            searchData = urllib.urlencode({
                'jschl_vc': fparam,
                'pass': sparam,
                'jschl_answer': result
            })
            searchUrl = 'http://www.dnvod.tv/cdn-cgi/l/chk_jschl?' + 'jschl_vc=' + str(
                fparam) + '&pass='******'&jschl_answer=' + str(
                    result)
            try:
                print searchUrl
                headers[
                    'Referer'] = 'http://www.dnvod.tv/Movie/Search.aspx?tags=a'
                req = urllib2.Request(searchUrl, headers=Searchheaders)
                time.sleep(5)
                sresult = opener.open(req)
                # print sresult.read()
                print sresult.info()
            except urllib2.HTTPError as e:
                print e.code
                print e.read()

    headers['Referer'] = 'http://www.dnvod.tv/'
    urlSearch = 'http://www.dnvod.tv/Movie/Search.aspx?tags=' + inputMovieName
    searchRequest = urllib2.Request(urlSearch, None, Searchheaders)
    searchResponse = opener.open(searchRequest)
    searchdataResponse = searchResponse.read()
    searchReg = r'<a href="(.*%3d)">'
    searchPattern = re.compile(searchReg)
    searchResult = searchPattern.findall(searchdataResponse)

    fo = open(rootDir + "/searchResult.txt", "w")
    for node in searchResult:
        fo.write(str(node) + '\n')
    fo.close

    searchRegName = r'3d" title="(.*)">'
    searchPatternName = re.compile(searchRegName)
    searchResultName = searchPatternName.findall(searchdataResponse)

    fo = open(rootDir + "/searchResultName.txt", "w")
    for node in searchResultName:
        fo.write(str(node) + '\n')
    fo.close

    listitem = xbmcgui.ListItem(
        '[COLOR FFFF00FF]Search result 当前搜索: [/COLOR][COLOR FFFFFF00](' +
        sstr + ') [/COLOR][COLOR FF00FFFF] Total 共计:' +
        str(len(searchResult)) + '[/COLOR]【[COLOR FF00FF00]' +
        'Click here for new search 点此输入新搜索内容' + '[/COLOR]】')
    url = sys.argv[0] + '?act=Search'
    xbmcplugin.addDirectoryItem(handle, url, listitem, True)
    for i in range(len(searchResultName)):
        listitem = xbmcgui.ListItem(searchResultName[i])
        url = sys.argv[0] + '?act=Searchr&id=' + str(i + 1)
        xbmcplugin.addDirectoryItem(handle, url, listitem, True)
        print str(i + 1) + ': ' + searchResultName[i] + '\n'
    xbmcplugin.endOfDirectory(handle)