def search(): kb = xbmc.Keyboard('', 'Search', False) lastSearch = None try: lastSearch = plugin.loadData('search') if lastSearch: kb.setDefault(lastSearch) except: pass kb.doModal() if (kb.isConfirmed()): inputText = kb.getText() try: plugin.saveData('search', inputText) except: pass if inputText == '': dialog = xbmcgui.Dialog().ok('Cautare', 'Nimic de cautat.') sys.exit() url = URL['search'] + urllib.quote_plus(inputText) tags = BeautifulSoup(http_req(url)).find('ul', { 'class': 'videolist' }).find_all('a') current = 0 while current <= len(tags) - 1 and not current == 10: img = tags[current].select('img')[0] name = nameFilter(img.get('alt').encode('utf-8')) link = tags[current].get('href') thumbnail = img.get('src') addDir(name, link, 3, thumbnail) current += 1 else: sys.exit() xbmcplugin.endOfDirectory(int(sys.argv[1]))
def search(): kb = xbmc.Keyboard('', 'Search', False) lastSearch = None try: lastSearch = plugin.loadData('search') if lastSearch: kb.setDefault(lastSearch) except: pass kb.doModal() if (kb.isConfirmed()): inputText = kb.getText() try: plugin.saveData('search', inputText) except: pass if inputText == '': dialog = xbmcgui.Dialog().ok('Cautare', 'Nimic de cautat.') sys.exit() url = URL['search'] + urllib.quote_plus(inputText) tags = BeautifulSoup(http_req(url)).find('ul', {'class': 'videolist'}).findAll('a', limit=10) total = len(tags) for tag in tags: img = tag.select('img')[0] name = nameFilter(img.get('alt').encode('utf-8')) link = tag.get('href') thumbnail = img.get('src') addDir(name, link, 3, thumbnail, totalItems=total) else: sys.exit() xbmcplugin.endOfDirectory(int(sys.argv[1]))
def SEARCH(cat): kb = xbmc.Keyboard('', 'Search', False) lastSearch = None try: lastSearch = plugin.loadData('search') if lastSearch: kb.setDefault(lastSearch) except: pass kb.doModal() if (kb.isConfirmed()): inputText = kb.getText() try: plugin.saveData('search', inputText) except: pass if inputText == '': dialog = xbmcgui.Dialog().ok('Search', 'There is nothing to search.') sys.exit() progress = xbmcgui.DialogProgress() progress.create('Progress', 'Please wait...') progress.update(1, "", "Loading list - 1%", "") searchText = {'kw': inputText} req = urllib2.Request(searchUrl, urllib.urlencode(searchText)) req.add_header('User-Agent', USER_AGENT) req.add_header('Cache-Control', 'no-transform') response = htmlFilter(urllib2.urlopen(req).read()) if cat == 'all': results = re.findall(r'<a href="(.+?)-(.+?)-online-download.html">.+?<div id="rest">(.+?)<div id="auth_dat">', response) thumb = re.findall(r'<img class="search" .+? src="../(.+?)"', response) else: results = re.findall(r'<a href="('+cat+')-(.+?)-online-download.html">.+?<div id="rest">(.+?)<div id="auth_dat">', response) thumb = re.findall(r'<a href="'+cat+'-.+?<img class="search" .+? src="../(.+?)"', response) total = len(results) current = 0 while current <= total - 1: if results[current][0] == 'seriale': name = re.sub('\(', ' (', results[current][2]) url = '%sseriale-%s-online-download.html' % (siteUrl, results[current][1]) thumbnail = urlFilter(thumb[current]) title = re.sub('\(.+?\)', '', name).strip() addDir(name,url,2,thumbnail,title) elif results[current][0] == 'filme': title = re.sub('\(', ' (', results[current][2]) url = '%sfilme-%s-online-download.html' % (siteUrl, results[current][1]) thumbnail = urlFilter(thumb[current]) addDir(title,url,8,thumbnail,title,folder=False) if progress.iscanceled(): sys.exit() percent = int(((current + 1) * 100) / total) message = "Loading list - " + str(percent) + "%" progress.update( percent, "", message, "" ) current += 1 progress.close() else: sys.exit() xbmcplugin.endOfDirectory(int(sys.argv[1]))
def SEARCH(cat): kb = xbmc.Keyboard('', 'Search', False) lastSearch = None try: lastSearch = plugin.loadData('search') if lastSearch: kb.setDefault(lastSearch) except: pass kb.doModal() if (kb.isConfirmed()): inputText = kb.getText() try: plugin.saveData('search', inputText) except: pass if inputText == '': dialog = xbmcgui.Dialog().ok('Search', 'There is nothing to search.') sys.exit() progress = xbmcgui.DialogProgress() progress.create('Progress', 'Please wait...') progress.update(1, "", "Loading list - 1%", "") searchText = {'kw': inputText} req = urllib2.Request(searchUrl, urllib.urlencode(searchText)) req.add_header('User-Agent', USER_AGENT) req.add_header('Cache-Control', 'no-transform') response = htmlFilter(urllib2.urlopen(req).read()) if cat == 'all': results = re.findall(r'<a href="(.+?)-(.+?)-online-download.html">.+?<div id="rest">(.+?)<div id="auth_dat">', response) thumb = re.findall(r'<img class="search" .+? src="../(.+?)"', response) else: results = re.findall(r'<a href="('+cat+')-(.+?)-online-download.html">.+?<div id="rest">(.+?)<div id="auth_dat">', response) thumb = re.findall(r'<a href="'+cat+'-.+?<img class="search" .+? src="../(.+?)"', response) total = len(results) current = 0 while current <= total - 1: if results[current][0] == 'seriale': name = re.sub('\(', ' (', results[current][2]) url = '%sseriale-%s-online-download.html' % (siteUrl, results[current][1]) thumbnail = siteUrl + thumb[current] title = re.sub('\(.+?\)', '', name).strip() addDir(name,url,2,thumbnail,title) elif results[current][0] == 'filme': title = re.sub('\(', ' (', results[current][2]) url = '%sfilme-%s-online-download.html' % (siteUrl, results[current][1]) thumbnail = siteUrl + thumb[current] addDir(title,url,8,thumbnail,title,folder=False) if progress.iscanceled(): sys.exit() percent = int(((current + 1) * 100) / total) message = "Loading list - " + str(percent) + "%" progress.update( percent, "", message, "" ) current += 1 progress.close() else: sys.exit() xbmcplugin.endOfDirectory(int(sys.argv[1]))