def search_cb(content, data): # movies, TV series and details movies = list_links(content, "http://www.youku.com/show_page/id_") details = list_links(content, "/detail/show/") n = (len(movies) + len(details)) >> 1 # videos links = movies + details + list_links(content, "http://v.youku.com/v_show/") moonplayer.show_list(links) for i in xrange(n): moonplayer.set_list_item_color(i, "#0000ff")
def search_cb(content, data): #movies, TV series and details movies = list_links(content, 'http://www.youku.com/show_page/id_') details = list_links(content, '/detail/show/') n = (len(movies) + len(details)) >> 1 #videos links = movies + details + list_links(content, 'http://v.youku.com/v_show/') moonplayer.show_list(links) for i in xrange(n): moonplayer.set_list_item_color(i, '#0000ff')
def search_cb(content, keyword): #movies and tv series result = list_links(content, 'http://www.iqiyi.com/lib/m_') n = len(result) / 2 #album result += list_links(content, 'http://www.iqiyi.com/a_') n2 = len(result) / 2 #single video result += list_links(content, 'http://www.iqiyi.com/w_', keyword) result += list_links(content, 'http://www.iqiyi.com/v_', keyword) moonplayer.show_list(result) for i in xrange(n): moonplayer.set_list_item_color(i, '#0000ff') for i in xrange(n, n2): moonplayer.set_list_item_color(i, '#ff00ff')
def load_item_cb(page, url): result = {} match = name_re.search(page) if match: result["name"] = match.group(1) match = img_re.search(page) if match: result["image"] = match.group(1) match = date_re.search(page) if match: result["dates"] = [match.group(1)] match = alt_re.search(page) if match: result["alt_names"] = [match.group(1)] detail_div = page.split('<div class="detail">', 1)[-1].split("</div>")[0] match = summ_re.search(detail_div) if match: result["summary"] = match.group(1) else: match = summ2_re.search(detail_div) if match: result["summary"] = match.group(1) match = rating_re.search(page) if match: result["rating"] = float(match.group(1)) result["source"] = list_links(page, "http://v.youku.com/v_show/id_") new_url = url.replace("/show_page/", "/show_episode/") moonplayer.get_url(new_url, load_item_cb2, result)
def search_cb(content, data): result = list_links(content, 'http://www.soku.com/u?url=') for i in xrange(1, len(result), 2): result[i] = result[i].replace('http://www.soku.com/u?url=', '') provider = result[i].split('.')[1] result[i-1] += ' (' + provider + ')' moonplayer.show_list(result)
def search_cb(content, data): result = list_links(content, 'http://www.soku.com/u?url=') for i in xrange(1, len(result), 2): result[i] = result[i].replace('http://www.soku.com/u?url=', '') provider = result[i].split('.')[1] result[i - 1] += ' (' + provider + ')' moonplayer.show_list(result)
def parse_album_cb(content, data): prefix = data[0] now_page = data[1] items = data[2] new_items = list_links(content, "http://v.youku.com/v_show/id_") items += new_items if len(new_items) > 0: url = prefix + "_ascending_1_mode_pic_page_" + str(now_page + 1) + ".html" moonplayer.get_url(url, parse_album_cb, (prefix, now_page + 1, items)) else: moonplayer.show_album(items)
def search_by_key_cb(content, data): content = content.replace('\n', '') result = [] pics = [] items = list_links(content, '/detail/show') match = pic_re.search(content) while match: pics.append(match.group(1)) match = pic_re.search(content, match.end(0)) for i in xrange(0, len(items), 2): result.append({'name': items[i], 'url': items[i+1], 'pic_url': pics[i/2]}) moonplayer.res_show(result)
def parse_album2_cb(content, data): prefix = data[0] now_page = data[1] items = data[2] new_items = list_links(content, "http://v.youku.com/v_show/id_") items += new_items if len(new_items) > 0: url = prefix + "&cp=" + str(now_page + 1) print len(new_items), url moonplayer.get_url(url, parse_album2_cb, (prefix, now_page + 1, items)) else: moonplayer.show_album(items)
def parse_album_cb(content, data): prefix = data[0] now_page = data[1] items = data[2] new_items = list_links(content, 'http://v.youku.com/v_show/id_') items += new_items if len(new_items) > 0: url = prefix + '_ascending_1_mode_pic_page_' + str(now_page + 1) + '.html' moonplayer.get_url(url, parse_album_cb, (prefix, now_page + 1, items)) else: moonplayer.show_album(items)
def explore_cb(page, data): # page = page.replace('\n', '') dict_url_img = {} match = img_re.search(page) while match: url, img = match.group(1, 2) dict_url_img[url] = img match = img_re.search(page, match.end(0)) result = list_links(page, "http://tv.sohu.com/item/") items = [] for i in xrange(0, len(result), 2): name = result[i] url = result[i + 1] pic_url = dict_url_img[url] item = {"name": name, "url": url, "pic_url": pic_url} items.append(item) moonplayer.res_show(items)
def search_cb(page, data): name2pic = {} result = [] # Read all pic urls match = pic_re.search(page) while match: (url, name) = match.group(1, 2) name2pic[name] = url match = pic_re.search(page, match.end(0)) # Read links, bind them with relative pic urls links = list_links(page, "http://www.youku.com/show_page/") for i in xrange(0, len(links), 2): name = links[i] url = links[i + 1] try: result.append({"name": name, "flag": url, "pic_url": name2pic[name]}) except KeyError: pass moonplayer.res_show(result)
def search_by_key_cb(content, data): result = [] items = content.split('<div class="detail">') for item in items: item = item.split('</div><!--detail end-->')[0].replace('\n', '') name_url = list_links(item, '/detail/show/') if len(name_url): name = name_url[0] url = name_url[1] match = pic_re.search(item) if match: pic = match.group(1) result.append({'name': name, 'url': url, 'pic_url': pic}) rest = items[-1].split('</div><!--item end-->', 1)[1].replace('\n', '') match = rest_re.search(rest) while match: (url, name, pic) = match.group(1, 2, 3) result.append({'name': name, 'url': url, 'pic_url': pic}) match = rest_re.search(rest, match.end(0)) moonplayer.res_show(result)
def search_cb(page, data): name2pic = {} result = [] # Read all pic urls match = pic2_re.search(page) while match: (url, name) = match.group(1, 2) name2pic[name] = url match = pic2_re.search(page, match.end(0)) # Read links, bind them with relative pic urls links = list_links(page, '/detail/show/') for i in xrange(0, len(links), 2): name = links[i] url = links[i+1] try: result.append({'name': name, 'url': url, 'pic_url': name2pic[name]}) except KeyError: pass moonplayer.res_show(result)
def search_cb(page, data): name2pic = {} result = [] # Read all pic urls match = pic_re.search(page) while match: (url, name) = match.group(1, 2) name2pic[name] = url match = pic_re.search(page, match.end(0)) # Read links, bind them with relative pic urls links = list_links(page, 'http://www.youku.com/show_page/') for i in xrange(0, len(links), 2): name = links[i] url = links[i+1] try: result.append({'name': name, 'flag': url, 'pic_url': name2pic[name]}) except KeyError: pass moonplayer.res_show(result)
def load_item_cb(page, data): result = {} # Picture try: match = pic_re.search(page.split("drama-pic")[1]) except IndexError: match = pic_re.search(page.split("movie-pic")[1]) if match: result["image"] = match.group(1) # Name match = name_re.search(page) if match: result["name"] = match.group(1) # Rating match = rating_re.search(page) if match: result["rating"] = float(match.group(1)) # Nation / Region match = nation_re.search(page) if match: result["nations"] = [match.group(1)] # Date match = date_re.search(page) if match: result["dates"] = match.group(1).split("/") # Director match = director_re.search(page) if match: result["directors"] = match.group(1).split("/") # Alternative names match = alt_name_re.search(page) if match: result["alt_names"] = match.group(1).split("/") # Summary match = summary_re.search(page) if match: result["summary"] = match.group(1).replace(" ", " ") # Videos' urls result["source"] = list_links(page, "http://tv.sohu.com/2") moonplayer.show_detail(result)
def explore_cb(page, data): page = page.split('大家都在看')[0] name2pic = {} result = [] # Read all pic urls match = pic_re.search(page) while match: url, name = match.group(1, 2) name2pic[name] = url match = pic_re.search(page, match.end(0)) # Read links, bind them with relative pic urls links = list_links(page, '//v.youku.com/v_show') for i in xrange(0, len(links), 2): name = links[i] url = 'http:' + links[i+1] try: result.append({'name': name, 'url': url, 'pic_url': name2pic[name]}) except KeyError: pass moonplayer.res_show(result)
def load_item_cb(page, url): result = {} match = name_re.search(page) if match: result['name'] = match.group(1) match = img_re.search(page) if match: result['image'] = match.group(1) match = date_re.search(page) if match: result['dates'] = [match.group(1)] match = alt_re.search(page) if match: result['alt_names'] = [match.group(1)] match = summ_re.search(page.split('Detail', 1)[-1]) if match: result['summary'] = match.group(1) match = rating_re.search(page) if match: result['rating'] = float(match.group(1)) result['source'] = list_links(page, 'http://v.youku.com/v_show/id_') new_url = url.replace('/show_page/', '/show_episode/') moonplayer.get_url(new_url, load_item_cb2, result)
def search_album_cb(content, data): links = list_links(content, 'http://www.youku.com/playlist_show/') moonplayer.show_list(links)
def search_album_cb(page, keyword): page = convert_to_utf8(page) links = list_links(page, 'http://www.tudou.com/playlist/id/', keyword) moonplayer.show_list(links)
def search_cb(content, data): links = list_links(content, 'http://www.tudou.com/programs/view/') moonplayer.show_list(links)
def search_album_cb(page, data): result = list_links(page, 'http://www.56.com/w') moonplayer.show_list(result)
def search_cb(content, data): result = list_links(content, '//v.youku.com/v_show') result = [ 'http:' + item if item.startswith('//') else item for item in result ] moonplayer.show_list(result)
def library_cb(content, data): links = list_links(content, 'http://www.youku.com/show_page/id_') moonplayer.show_list(links)
def parse_movie_cb(content, data): links = list_links(content, 'http://v.youku.com/v_show/') moonplayer.show_album(links)
def parse_tv_cb(content, data): result = list_links(content, 'http://www.iqiyi.com/dian') result += list_links(content, 'http://www.iqiyi.com/v_') moonplayer.show_album(result)
def search_album_cb(content, data): links = list_links(content, "/search_playlistdetail?") links += list_links(content, "http://www.youku.com/playlist_show/") moonplayer.show_list(links)
def load_item_cb2(page, result): srcs = list_links(page, 'http://v.youku.com/v_show/id_') if len(srcs): result['source'] = srcs moonplayer.show_detail(result)