def GetSearchResults(query=None, type=None, imdb_id=None): items = [] if (imdb_id): res = MediaInfo() res.type = type res.id = "/item.php?imdb=" + imdb_id res.title = query items.append(res) else: soup = BeautifulSoup( HTTP.Request(LMWT_SEARCH_URL + "?search", cacheTime=0).content) key = soup.find('input', {'type': 'hidden', 'name': 'key'})['value'] section = "1" if (type == "tv"): section = "2" url = LMWT_SEARCH_URL + "?search_section=" + section + "&search_keywords=" + urllib.quote_plus( query) + "&key=" + key + "&sort=views" soup = BeautifulSoup(HTTP.Request(url, cacheTime=0).content) #Log(soup) for item in soup.findAll("div", {'class': 'index_item index_item_ie'}): #Log('Found item: ' + str(item)) res = MediaInfo() res.type = type # Extract out title res.title = re.search("Watch (.*)", item.find('a')['title']).group(1).strip() match = re.search("(.*)\((\d*)\)", res.title) if (match): res.title = match.group(1).strip() res.year = int(match.group(2).strip()) # Extract out URL res.id = item.a['href'][1:] # Extract out thumb res.poster = item.find('img')['src'] # Extract out rating rating_style = item.find('li')['style'] res.rating = re.search("width:\s(\d)*px;", rating_style).group(1) # Add to item list. #Log("Adding item: " + str(res)) items.append(res) #Log(items) return items
def GetSearchResults(query=None,type=None,imdb_id=None, exact=False): items = [] if (imdb_id): res = MediaInfo() res.type = type res.id = "/item.php?imdb=" + imdb_id res.title = query items.append(res) else: soup = BeautifulSoup(HTTP.Request(Dict['LMWT_SEARCH_URL'] + "?search",cacheTime=0).content) key = soup.find('input', { 'type': 'hidden', 'name': 'key' })['value'] section = "1" if (type == "tv"): section = "2" url = Dict['LMWT_SEARCH_URL'] + "?search_section=" + section + "&search_keywords=" + urllib.quote_plus(query) + "&key=" + key + "&sort=views" soup = BeautifulSoup(HTTP.Request(url,cacheTime=0).content) #Log(soup) for item in soup.findAll("div", { 'class': 'index_item index_item_ie' }): #Log('Found item: ' + str(item)) res = MediaInfo() res.type = type # Extract out title res.title = re.search("Watch (.*)", item.find('a')['title']).group(1).strip() match = re.search("(.*)\((\d*)\)", res.title) if (match): res.title = match.group(1).strip() res.year = int(match.group(2).strip()) # Extract out URL res.id = item.a['href'][1:] # Extract out thumb res.poster = item.find('img')['src'] # Extract out rating rating_style = item.find('li')['style'] res.rating = re.search("width:\s(\d)*px;", rating_style).group(1); # Add to item list. #Log("Adding item: " + str(res)) if not exact or res.title.lower() == query.lower(): items.append(res) #Log(items) return items
def GetItems(type, genre=None, sort=None, alpha=None, pages=5, start_page=0): page_num = 0 items = [] while (page_num < pages): page_num = page_num + 1 url = GetURL(type=type, genre=genre, sort=sort, alpha=alpha, page_num=page_num + start_page) url_parts = urlparse.urlparse(url) soup = BeautifulSoup(HTTP.Request(url).content) for item in soup.findAll("div", {'class': 'index_item index_item_ie'}): #Log('Found item: ' + str(item)) res = MediaInfo() res.type = type # Extract out title res.title = re.search("Watch (.*)", item.find('a')['title']).group(1).strip() match = re.search("(.*)\((\d*)\)", res.title) if (match): res.title = match.group(1).strip() res.year = int(match.group(2).strip()) # Extract out URL res.id = item.a['href'][1:] # Extract out thumb. Note that extracted path may be relative. poster_url = item.find('img')['src'] if poster_url.startswith("//"): poster_url = url_parts.scheme + ":" + poster_url elif poster_url.startswith("/"): # Deal with fully-relative paths. Doesn't deal with partial relative paths. poster_url = url_parts.scheme + "://" + url_parts.netloc + poster_url res.poster = poster_url # Extract out rating rating_style = item.find('li')['style'] rating = re.search("width:\s([\d\.]*)px;", rating_style).group(1) if (rating is not None and rating <> ""): res.rating = int(int(rating) / 10) # Add to item list. #Log("Adding item: " + str(res)) items.append(res) return items
def GetItems(type, genre = None, sort = None, alpha = None, pages = 5, start_page = 0): page_num = 0 items = [] while (page_num < pages): page_num = page_num + 1 url = GetURL(type = type, genre = genre, sort = sort, alpha = alpha, page_num = page_num + start_page) url_parts = urlparse.urlparse(url) soup = BeautifulSoup(HTTP.Request(url).content) for item in soup.findAll("div", { 'class': 'index_item index_item_ie' }): #Log('Found item: ' + str(item)) res = MediaInfo() res.type = type # Extract out title res.title = re.search("Watch (.*)", item.find('a')['title']).group(1).strip() match = re.search("(.*)\((\d*)\)", res.title) if (match): res.title = match.group(1).strip() res.year = int(match.group(2).strip()) # Extract out URL res.id = item.a['href'][1:] # Extract out thumb. Note that extracted path may be relative. poster_url = item.find('img')['src'] if poster_url.startswith("//"): poster_url = url_parts.scheme + ":" + poster_url elif poster_url.startswith("/"): # Deal with fully-relative paths. Doesn't deal with partial relative paths. poster_url = url_parts.scheme + "://" + url_parts.netloc + poster_url res.poster = poster_url # Extract out rating rating_style = item.find('li')['style'] rating = re.search("width:\s([\d\.]*)px;", rating_style).group(1); if (rating is not None and rating <> ""): res.rating = int(int(rating) / 10) # Add to item list. #Log("Adding item: " + str(res)) items.append(res) return items
def GetItems(type, genre=None, sort=None, alpha=None, pages=5, start_page=0): page_num = 0 items = [] while (page_num < pages): page_num = page_num + 1 url = GetURL(type=type, genre=genre, sort=sort, alpha=alpha, page_num=page_num + start_page) soup = BeautifulSoup(HTTP.Request(url).content) for item in soup.findAll("div", {'class': 'index_item index_item_ie'}): #Log('Found item: ' + str(item)) res = MediaInfo() res.type = type # Extract out title res.title = re.search("Watch (.*)", item.find('a')['title']).group(1).strip() match = re.search("(.*)\((\d*)\)", res.title) if (match): res.title = match.group(1).strip() res.year = int(match.group(2).strip()) # Extract out URL res.id = item.a['href'][1:] # Extract out thumb res.poster = item.find('img')['src'] # Extract out rating rating_style = item.find('li')['style'] rating = re.search("width:\s([\d\.]*)px;", rating_style).group(1) if (rating is not None and rating <> ""): res.rating = int(int(rating) / 10) # Add to item list. #Log("Adding item: " + str(res)) items.append(res) return items
def GetItems(type, genre = None, sort = None, alpha = None, pages = 5, start_page = 0): page_num = 0 items = [] while (page_num < pages): page_num = page_num + 1 url = GetURL(type = type, genre = genre, sort = sort, alpha = alpha, page_num = page_num + start_page) soup = BeautifulSoup(HTTP.Request(url).content) for item in soup.findAll("div", { 'class': 'index_item index_item_ie' }): #Log('Found item: ' + str(item)) res = MediaInfo() res.type = type # Extract out title res.title = re.search("Watch (.*)", item.find('a')['title']).group(1).strip() match = re.search("(.*)\((\d*)\)", res.title) if (match): res.title = match.group(1).strip() res.year = int(match.group(2).strip()) # Extract out URL res.id = item.a['href'][1:] # Extract out thumb res.poster = item.find('img')['src'] # Extract out rating rating_style = item.find('li')['style'] rating = re.search("width:\s([\d\.]*)px;", rating_style).group(1); if (rating is not None and rating <> ""): res.rating = int(int(rating) / 10) # Add to item list. #Log("Adding item: " + str(res)) items.append(res) return items