def get_servers(self): try: if '/phim/' in self.link: link = self.link.replace('/phim/', '/xem-phim/') data = yield http_client(link, c_try=5, c_delay=self.delay) servers = [] data = data.split('<div id="eps">',1)[1].split('<p class="epi">', 1)[1].split('</div>',1)[0] srvs = data.split('<p class="epi">') for srv in srvs: name = srv.split('<b>- Server ',1)[1].rsplit('</b>', 1)[0] if name == "PHIMVÀNG": name = "VIPER" server = { "name" : name, "movie" : [] } chaps_link = "http://phimvang.org"+srv.split('Xem Full',1)[0].split('<a href="',1)[1].split('"',1)[0] chaps_xml = chaps_link.replace('.html', '.xml') chaps_data = yield http_client(chaps_xml, c_try=5, c_delay=self.delay) chaps = chaps_data.split('<track>',1)[1].rsplit('</track>',1)[0].split('</track>') for chap in chaps: name = chap.rsplit('<title>',1)[1].split('</title>',1)[0] link = chap.split('<location>',1)[1].split('</location>',1)[0] chap = { "source": [chaps_link, chaps_xml, link], "name": name, } server['movie'].append(chap) servers.append(server) return servers except Exception as e: traceback.print_exc(file=sys.stdout)
def part_cache(self, link): try: cache = {'expire': 0} if 'picasaweb' in link[:18]: data = yield function.http_client(link, c_try=5, c_delay=0) if data: data = escape.json_decode(data) cache['video'] = [] video = data['feed']['media']['content'] for v in video: if not cache['expire'] and 'expire' in v['url']: cache['expire'] = int(v['url'].split('expire=',1)[1].split('&',1)[0]) if 'type' in v and (v['type'].startswith('video/') or v['type'].startswith('application/')): cache['video'].append(v) return cache # elif 'youtube.com' in link[:28] or 'youtu.be' in link[:16]: # cache['expire'] = 9999999999 # # http://youtu.be/x2J6YQS8RRE # if 'youtu.be/' in link[:17]: # vd_id = link.split('youtu.be/',2) # if len(vd_id) > 1: # cache['video'] = "https://www.youtube.com/watch?v=%s" % vd_id[1] # if not 'video' in cache: # cache['video'] = link # return cache return None except Exception as e: traceback.print_exc(file=sys.stdout)
def get_servers(self): try: if '/phim/' in self.link: link = self.link.replace('/phim/', '/xem-phim/') data = yield http_client(link, c_try=5, c_delay=self.delay) servers = [] data = data.split('<ul id="server_list">',1)[1].split('</div>',1)[0].split('<li class="server_item">', 1)[1] srvs = data.split('<li class="server_item">') for srv in srvs: name = srv.split(': </strong>',1)[0].rsplit('>', 1)[1] server = { "name" : name, "movie" : [] } chaps = srv.split('<li class="active">',1) if len(chaps) == 2: chaps = chaps[1].rsplit('</a>', 1)[0].split('</a>') else: chaps = srv.split('<li class="">',1)[1].rsplit('</a>', 1)[0].split('</a>') for chp in chaps: link = chp.split('href="',1)[1].split('"',1)[0] name = chp.rsplit('>',1)[1] chap = { "source": [link], "name": name } server['movie'].append(chap) servers.append(server) return servers except Exception as e: traceback.print_exc(file=sys.stdout)
def get_servers(self): try: if "/phim/" in self.movie_view_link: self.movie_view_link = self.movie_view_link.replace("/phim/", "/xem-phim/") data = yield http_client(self.movie_view_link, c_try=5, c_delay=self.delay) servers = [] data = data.split('<div class="eplist" id="_listep">', 1)[1].rsplit("</span><br />", 1)[0] srvs = data.split("</span><br />") for srv in srvs: if not srv.strip(): continue print("servers", srv) name = srv.split("<span class='svname'>", 1)[1].split(":</span>", 1)[0].strip() if "SV " in name: name = name.split("SV ", 1)[1].strip() if "Picasaweb" in name: name = "VIP" server = {"name": name, "movie": []} chaps = srv.split("<span class='svep'>", 1)[1].rsplit("</a>", 1)[0].split('</a><a id="') for chap in chaps: name = chap.rsplit('">', 1)[1].strip() link = chap.split('href="', 1)[1].split('"', 1)[0].strip() url = "http://phimtv.vn/xml/%s.xml" % chap.split("setupplayer(", 1)[1].split(",", 1)[0].strip() chap = {"source": [link, url], "name": name} server["movie"].append(chap) servers.append(server) return servers except Exception as e: traceback.print_exc(file=sys.stdout)
def get_servers(self): try: if "/phim/" in self.link: self.link = self.link.replace("/phim/", "/xem-phim/") data = yield http_client(self.link, c_try=5, c_delay=self.delay) servers = [] data = data.split("<div class='label'>", 1)[1].rsplit("</li></ul><br /></span>", 1)[0] srvs = data.split("<div class='label'>") for srv in srvs: if not srv.strip(): continue print("servers", srv) name = srv.split("<img src=", 1)[1].split(">", 1)[1].split(":<", 1)[0].strip() if "Picasa" in name: name = "VIP" server = {"name": name, "movie": []} chaps = srv.rsplit("</a>", 1)[0].split('</a><a id="') for chap in chaps: name = chap.rsplit('">', 1)[1].strip() link = chap.split('href="', 1)[1].split('"', 1)[0].strip() url = ( "http://phimtructuyenhd.com/xml/%s.xml" % chap.split('onclick="setupplayer(', 1)[1].split(",", 1)[0].strip() ) chap = {"source": [link, url], "name": name} server["movie"].append(chap) servers.append(server) return servers except Exception as e: traceback.print_exc(file=sys.stdout)
def get_servers(self): try: if '/phim/' in self.movie_view_link: self.movie_view_link = self.movie_view_link.replace('/phim/', '/xem-phim/') data = yield http_client(self.movie_view_link, c_try=5, c_delay=self.delay) servers = [] srvs = [data.split('<div class="pagesnumb">',1)[1].split('</li></a></ul></div></div>',1)[0]] for srv in srvs: if not srv.strip(): continue print('servers',srv) server = { "name" : "VIP", "movie" : [] } chaps = srv.split('</li></a><a id="') for chap in chaps: name = chap.rsplit('<li>',1)[1].strip() link = chap.split(' href="',1)[1].split('"',1)[0].strip() chap = { "source": [link], "name": name, } server['movie'].append(chap) servers.append(server) return servers except Exception as e: traceback.print_exc(file=sys.stdout)
def get_servers(self): try: if '/phim/' in self.link: link = self.link.replace('/phim/', '/xem-phim/') data = yield http_client(link, c_try=5, c_delay=self.delay) servers = [] data = data.split('<div id="eps">',1)[1].split('<p class="epi">', 1)[1].split('</div>',1)[0] srvs = data.split('<p class="epi">') for srv in srvs: if '<b>Download phim:</b>' in srv: continue name = srv.split('<b>',1)[1].split('</b>', 1)[0] if 'Danh sách tập' in name: name = "VIPER" server = { "name" : name, "movie" : [] } chaps = srv.split('</b>', 1)[1].split('</p>', 1)[0].rsplit('</a>',1)[0].split('</a>') for chap in chaps: print(chap) name = chap.rsplit('">',1)[1].strip() link = "http://phimhd.vn" + chap.split(' href="',1)[1].split('"',1)[0] chap = { "source": [link], "name": name, } server['movie'].append(chap) servers.append(server) return servers except Exception as e: traceback.print_exc(file=sys.stdout)
def get_servers(self): try: if '/phim/' in self.link: link = self.link.replace('/phim/', '/xem-phim/') data = yield http_client(link, c_try=5, c_delay=self.delay) servers = [] data = data.split('<ul id="server_list">', 1)[1].split( '</div>', 1)[0].split('<li class="server_item">', 1)[1] srvs = data.split('<li class="server_item">') for srv in srvs: name = srv.split(': </strong>', 1)[0].rsplit('>', 1)[1] server = {"name": name, "movie": []} chaps = srv.split('<li class="active">', 1) if len(chaps) == 2: chaps = chaps[1].rsplit('</a>', 1)[0].split('</a>') else: chaps = srv.split('<li class="">', 1)[1].rsplit('</a>', 1)[0].split('</a>') for chp in chaps: link = chp.split('href="', 1)[1].split('"', 1)[0] name = chp.rsplit('>', 1)[1] chap = {"source": [link], "name": name} server['movie'].append(chap) servers.append(server) return servers except Exception as e: traceback.print_exc(file=sys.stdout)
def get_servers(self): try: if '/phim/' in self.movie_view_link: self.movie_view_link = self.movie_view_link.replace( '/phim/', '/xem-phim/') data = yield http_client(self.movie_view_link, c_try=5, c_delay=self.delay) servers = [] srvs = [ data.split('<div class="pagesnumb">', 1)[1].split('</li></a></ul></div></div>', 1)[0] ] for srv in srvs: if not srv.strip(): continue print('servers', srv) server = {"name": "VIP", "movie": []} chaps = srv.split('</li></a><a id="') for chap in chaps: name = chap.rsplit('<li>', 1)[1].strip() link = chap.split(' href="', 1)[1].split('"', 1)[0].strip() chap = { "source": [link], "name": name, } server['movie'].append(chap) servers.append(server) return servers except Exception as e: traceback.print_exc(file=sys.stdout)
def get_link(self, link): try: data = yield http_client(link, c_try=5, c_delay=self.delay) data = escape.url_unescape(data.split('&proxy.link=',1)[1].split('"',1)[0].split('&',1)[0].strip()) print(link, data) return data except Exception as e: traceback.print_exc(file=sys.stdout) return None
def get_link(self, link): try: data = yield http_client(link, c_try=5, c_delay=self.delay) data = escape.url_unescape(data.split('&proxy.link=',1)[1].split('&',1)[0].strip()) print(link, data) return data except Exception as e: traceback.print_exc(file=sys.stdout) return None
def get_link(self, link): try: data = yield http_client(link, c_try=5, c_delay=self.delay) data = data.split("</title><location>", 1)[1].split("</location>", 1)[0].strip() print(link, data) return data except Exception as e: traceback.print_exc(file=sys.stdout) return None
def get_link(self, link): try: link = "http://movie.vndailys.com/xml/%s.xml" % link.rsplit('/m',1)[1].split('.',1)[0].strip() data = yield http_client(link, c_try=5, c_delay=self.delay) data = data.split('</title><location>',1)[1].split('</location>',1)[0].strip() print(link, data) return data except Exception as e: traceback.print_exc(file=sys.stdout) return None
def get_link(self, link): try: data = yield http_client(link, c_try=5, c_delay=self.delay) data = data.split('</title><location>', 1)[1].split('</location>', 1)[0].strip() print(link, data) return data except Exception as e: traceback.print_exc(file=sys.stdout) return None
def get_link(self, link): try: data = yield http_client(link, c_try=5, c_delay=self.delay) data = data.split('<param name="FlashVars" value="', 1)[1].split('>',1)[0] data = data.split('proxy.link=phim14*',2)[1].split('&', 1)[0] cryptor = filmDecrypter.filmDecrypter(198,128) movie = cryptor.decrypt(data, key,'ECB').split('\0')[0] return movie except Exception as e: traceback.print_exc(file=sys.stdout) return None
def get_link(self, link): try: data = yield http_client(link, c_try=5, c_delay=self.delay) data = data.split('<param name="FlashVars" value="', 1)[1].split('>', 1)[0] data = data.split('proxy.link=phim14*', 2)[1].split('&', 1)[0] cryptor = filmDecrypter.filmDecrypter(198, 128) movie = cryptor.decrypt(data, key, 'ECB').split('\0')[0] return movie except Exception as e: traceback.print_exc(file=sys.stdout) return None
def get_link(self, link): try: data = yield http_client(link, c_try=5, c_delay=self.delay) try: data = escape.url_unescape(data.split('proxy.link=',1)[1].split('"',1)[0].split('&',1)[0].strip()) except: data = data.split('<param name="movie" value="',1)[1].split('"',1)[0] data = escape.url_unescape(data) if 'youtube' in data: data = data.split('?',1)[0].strip() print(link, data) return data except Exception as e: traceback.print_exc(file=sys.stdout) return None
def search(self, text): movies = [] try: text = escape.url_escape(text) text = "http://phimtv.vn/search.php?q=%s&limit=20" % text data = yield http_client(text, c_try=5, c_delay=self.delay) data = data.split("</a></li>", 1)[1].rsplit("</a></li>", 1)[0].split("</a></li>") movies = [] for m in data: link = m.split('<a href="', 1)[1].split('"', 1)[0] title = " - ".join(m.split("<strong>", 1)[1].split("<br ", 1)[0].split("</strong><br>")) image = "http://phimtv.vn/" + m.split('src="', 1)[1].split('"', 1)[0] movies.append({"link": link, "title": title, "image": image}) except Exception as e: traceback.print_exc(file=sys.stdout) return movies
def get_servers(self): try: if '/phim/' in self.link: self.link = self.link.replace('/phim/', '/xem-phim/') data = yield http_client(self.link, c_try=5, c_delay=self.delay) servers = [] try: data = data.split('<div class="listserver">',1)[1].split('<span class="name">',1)[1].split('</b></a> </div>',1)[0] srvs = data.split('<span class="name">') for srv in srvs: if not srv.strip(): continue name = srv.split(':</span>',1)[0].strip() if 'Picasa' in name: name = "VIP" server = { "name" : name, "movie" : [] } chaps = srv.split('</b></a> <a ') for chap in chaps: name = chap.rsplit('>',1)[1].strip() link = chap.split('href="',1)[1].split('"',1)[0].strip() chap = { "source": [link], "name": name, } server['movie'].append(chap) servers.append(server) except: server = { "name" : "VIP", "movie" : [{ "source": [self.link], "name": "Full" }] } servers.append(server) return servers except Exception as e: traceback.print_exc(file=sys.stdout)
def get_link(self, link): try: data = yield http_client(link, c_try=5, c_delay=self.delay) try: data = escape.url_unescape( data.split('proxy.link=', 1)[1].split('"', 1)[0].split('&', 1)[0].strip()) except: data = data.split('<param name="movie" value="', 1)[1].split('"', 1)[0] data = escape.url_unescape(data) if 'youtube' in data: data = data.split('?', 1)[0].strip() print(link, data) return data except Exception as e: traceback.print_exc(file=sys.stdout) return None
def get_servers(self): try: if '/phim/' in self.movie_view_link: self.movie_view_link = self.movie_view_link.replace( '/phim/', '/xem-phim/') data = yield http_client(self.movie_view_link, c_try=5, c_delay=self.delay) servers = [] data = data.split('<div class="eplist" id="_listep">', 1)[1].rsplit('</span><br />', 1)[0] srvs = data.split('</span><br />') for srv in srvs: if not srv.strip(): continue print('servers', srv) name = srv.split("<span class='svname'>", 1)[1].split(':</span>', 1)[0].strip() if 'SV ' in name: name = name.split('SV ', 1)[1].strip() if 'Picasaweb' in name: name = "VIP" server = {"name": name, "movie": []} chaps = srv.split("<span class='svep'>", 1)[1].rsplit('</a>', 1)[0].split('</a><a id="') for chap in chaps: name = chap.rsplit('">', 1)[1].strip() link = chap.split('href="', 1)[1].split('"', 1)[0].strip() url = "http://phimtv.vn/xml/%s.xml" % chap.split( 'setupplayer(', 1)[1].split(',', 1)[0].strip() chap = { "source": [link, url], "name": name, } server['movie'].append(chap) servers.append(server) return servers except Exception as e: traceback.print_exc(file=sys.stdout)
def search(self, text): movies = [] try: text = escape.url_escape(text) text = "http://movie.vndailys.com/search.php?q=%s&limit=20" % text data = yield http_client(text, c_try=5, c_delay=self.delay) data = data.split('</a></li>',1)[1].rsplit('</a></li>',1)[0].split('</a></li>') movies = [] for m in data: link = m.split('<a href="',1)[1].split('"',1)[0] title = ' - '.join(m.split('<strong>',1)[1].split('<br ',1)[0].split('</strong><br>')) image = 'http://phimtv.vn/' + m.split('src="',1)[1].split('"',1)[0] movies.append({ "link": link, "title": title, "image": image }) except Exception as e: traceback.print_exc(file=sys.stdout) return movies
def search(self, text): movies = [] try: text = escape.url_escape(text) text = 'https://www.google.com.vn/search?q=intitle:"%s"&sitesearch=xemphim2.com&gws_rd=ssl' % text print(text) data = yield http_client(text, c_try=5, c_delay=self.delay) data = data.split('<div id="akp_target"', 1)[1].split('<!--m-->', 1)[1].rsplit( '</div></div></div><!--n--></li></div>', 1)[0].split('<!--m-->') for m in data: link = m.split('href="', 1)[1].split('"', 1)[0] title = m.split('href="', 1)[1].split('">', 1)[1].split('</a>', 1)[0] image = "" movies.append({"link": link, "title": title, "image": image}) except Exception as e: traceback.print_exc(file=sys.stdout) return movies
def get_servers(self): try: if '/phim/' in self.link: self.link = self.link.replace('/phim/', '/xem-phim/') data = yield http_client(self.link, c_try=5, c_delay=self.delay) servers = [] data = data.split("<div class='label'>", 1)[1].rsplit('</li></ul><br /></span>', 1)[0] srvs = data.split("<div class='label'>") for srv in srvs: if not srv.strip(): continue print('servers', srv) name = srv.split("<img src=", 1)[1].split(">", 1)[1].split(':<', 1)[0].strip() if 'Picasa' in name: name = "VIP" server = {"name": name, "movie": []} chaps = srv.rsplit('</a>', 1)[0].split('</a><a id="') for chap in chaps: name = chap.rsplit('">', 1)[1].strip() link = chap.split('href="', 1)[1].split('"', 1)[0].strip() url = "http://phimtructuyenhd.com/xml/%s.xml" % chap.split( 'onclick="setupplayer(', 1)[1].split(',', 1)[0].strip() chap = { "source": [link, url], "name": name, } server['movie'].append(chap) servers.append(server) return servers except Exception as e: traceback.print_exc(file=sys.stdout)
def search(self, text): movies = [] try: text = escape.url_escape(text) text = 'https://www.google.com.vn/search?q=intitle:"%s"&sitesearch=xemphim2.com&gws_rd=ssl' % text print(text) data = yield http_client(text, c_try=5, c_delay=self.delay) data = data.split('<div id="akp_target"',1)[1].split('<!--m-->',1)[1].rsplit('</div></div></div><!--n--></li></div>',1)[0].split('<!--m-->') for m in data: link = m.split('href="',1)[1].split('"',1)[0] title = m.split('href="',1)[1].split('">',1)[1].split('</a>',1)[0] image = "" movies.append({ "link": link, "title": title, "image": image }) except Exception as e: traceback.print_exc(file=sys.stdout) return movies
def get_servers(self): try: if '/phim/' in self.link: link = self.link.replace('/phim/', '/xem-phim/') data = yield http_client(link, c_try=5, c_delay=self.delay) servers = [] data = data.split('<div id="eps">', 1)[1].split('<p class="epi">', 1)[1].split('</div>', 1)[0] srvs = data.split('<p class="epi">') for srv in srvs: if '<b>Download phim:</b>' in srv: continue name = srv.split('<b>', 1)[1].split('</b>', 1)[0] if 'Danh sách tập' in name: name = "VIPER" server = {"name": name, "movie": []} chaps = srv.split('</b>', 1)[1].split('</p>', 1)[0].rsplit('</a>', 1)[0].split('</a>') for chap in chaps: print(chap) name = chap.rsplit('">', 1)[1].strip() link = "http://phimhd.vn" + chap.split( ' href="', 1)[1].split('"', 1)[0] chap = { "source": [link], "name": name, } server['movie'].append(chap) servers.append(server) return servers except Exception as e: traceback.print_exc(file=sys.stdout)
def get_servers(self): try: if '/phim/' in self.movie_view_link: self.movie_view_link = self.movie_view_link.replace('/phim/', '/xem-phim/') data = yield http_client(self.movie_view_link, c_try=5, c_delay=self.delay) servers = [] data = data.split('<div class="eplist" id="_listep">',1)[1].split('</span></p></div>',1)[0] srvs = data.split('</span><br />') for srv in srvs: if not srv.strip(): continue print('servers',srv) name = srv.split("<span class='svname'>",1)[1].split(':</span>',1)[0].strip() if 'SV ' in name: name = name.split('SV ',1)[1].strip() if 'Picasaweb' in name: name = "VIP" server = { "name" : name, "movie" : [] } chaps = srv.split("<span class='svep'>", 1)[1].rsplit('</a>', 1)[0].split('</a><a id="') for chap in chaps: name = chap.rsplit('">',1)[1].strip() link = chap.split('href="',1)[1].split('"',1)[0].strip() chap = { "source": [link], "name": name, } server['movie'].append(chap) servers.append(server) return servers except Exception as e: traceback.print_exc(file=sys.stdout)
def get_info(self): try: data = yield http_client(self.link, c_try=5, c_delay=self.delay) data = data.split('<div class="intro">', 2)[1].split('</div><!--/.block-->', 1)[0] # poster data = data.split('<div class="info">', 2) poster = data[0].split(' src="', 2)[1].split('"', 1)[0].strip() # title data = data[1].split('<div class="alt1">Đạo diễn', 2) title = data[0].split('color="white">', 2)[1].split('<', 1)[0].strip() tmp = title.split(' - ', 1) title = tmp[0] subtitle = tmp[1].rsplit(' ', 1)[0] # director data = data[1].split('<div class="alt2">Diễn viên', 2) director = [ data[0].split('title="', 2)[1].split('"', 1)[0].strip() ] # stars data = data[1].split('<div class="alt1">Thể loại', 2) temp = data[0].split('</a>,') stars = [] for tmp in temp: tmp = tmp.split('title="', 2)[1].split('"', 1)[0].strip() stars.append(tmp) # category data = data[1].split('<div class="alt2">Quốc Gia', 2) temp = data[0].split('</a>,') category = [] for tmp in temp: tmp = tmp.split('title="', 2)[1].split('"', 1)[0].strip() category.append(tmp) # country data = data[1].split('<div class="alt1">Thời lượng:', 2) country = data[0].split('title="Xem Phim ', 2)[1].split('"', 1)[0] # length data = data[1].split('<div class="alt2">Năm phát hành:', 2) length = data[0].split('</div>', 1)[0].strip() # year data = data[1].split('<div class="alt1">Lượt xem:', 2) year = data[0].split('title="Phim ', 2)[1].split('"', 1)[0].strip() # descript_long data = data[1].split('<div class="alt1">Thời lượng:', 2) descript_long = data[0].split( '<div class="description">', 2)[1].split('<div class="message">', 2)[1].split('<div class="title hr"><span>Trailer:', 1)[0].rsplit('</div>', 1)[0].strip() response = { "poster": poster, "title": title, "subtitle": subtitle, "director": director, "stars": stars, "category": category, "country": country, "length": length, "year": year, "descript_long": descript_long } return response except Exception as e: traceback.print_exc(file=sys.stdout)
def get_info(self): try: self.data = yield http_client(self.link, c_try=5, c_delay=self.delay) data = self.data.split(" id='thongtinphim'>", 1)[1] data = data.split('<div class="description">', 1)[0] # trailer try: trailer = [ "https://www.youtube.com/watch?v=" + data.split( 'Trailer;phimsohd.y/', 1)[1].split('|', 1)[0].strip() ] except: trailer = "" # poster poster = data.split('<img src="', 1)[1].split('"', 1)[0].strip() # title title = data.split('<b class="thongtin tenphim">Phim: </b>', 1)[1].split('</h2>', 1)[0].strip() tmp = title.split(' - ', 1) title = tmp[0].strip() if len(tmp) > 1: subtitle = tmp[1].strip() else: subtitle = "" # length length = {} try: tmp = data.split('<b class="thongtin">Tập: </b>', 1)[1].split("<br />", 1)[0].strip() length['count'] = int(tmp.split(' ', 1)[0].strip()) if 'Tập' in tmp: length['type'] = "long" except: length['count'] = 100 length['type'] = "short" # category category = [ d.strip() for d in data.split('<b class="thongtin">Thể loại: </b>', 1) [1].split('<br />', 1)[0].split(',') ] # director director = [] # stars stars = [ d.strip() for d in data.split('<b class="thongtin">Thể loại: </b>', 1) [1].split('<br />', 1)[0].split(',') ] # year year = data.split('<b class="thongtin">Năm PH: </b>', 1)[1].split('<br />', 1)[0].strip() # country country = data.split('<b class="thongtin">Quốc gia: </b>', 1)[1].split('<br />', 1)[0].strip() # description description = data.split('<b class="thongtin">Giới thiệu: </b>', 1)[1].split('</div>', 1)[0].strip() ### response = { "poster": poster, "title": subtitle, # pass "subtitle": title, # pass "trailer": trailer, "director": director, "stars": stars, "category": category, "country": country, "length": length, "year": year, "description": description } print(response) return response except Exception as e: traceback.print_exc(file=sys.stdout)
def get_movie_link_cache(self, link, cache_time=3600): try: # youtube if 'youtube.com' in link[:28] or 'youtu.be' in link[:16]: if 'youtu.be/' in link[:17]: vd_id = link.split('youtu.be/',2) if len(vd_id) > 1: return "https://www.youtube.com/watch?v=%s" % vd_id[1] return link # picasaweb elif 'picasaweb' in link[:18]: # find cache cache_result = yield self.site.cache.get(source=link, lock=True, lock_count=30) if cache_result and 'data' in cache_result: return cache_result['data'] source = yield function.http_client(link, c_delay=0) source = escape.json_decode(source) # print('source', source) json = source['feed']['media']['content'] expire = 0 video = [] for v in json: if not expire and 'expire' in v['url']: expire = int(v['url'].split('expire=',1)[1].split('&',1)[0]) if 'type' in v and (v['type'].startswith('video/') or v['type'].startswith('application/')): video.append(v) # store cache cache_time = cache_time + int(time()) if expire > cache_time: self.set_movie_link_cache(link, video, expire - cache_time) return video elif 'docs.google.com' in link[:25]: source = yield function.http_client(link, c_delay=0) s_format = source.split('["fmt_list","',1)[1].split('"]',1)[0].split(',') v_format = {} for f in s_format: f = f.split('/', 2) size = f[1].split('x') v_format[f[0]] = size video = [] s_video = source.split('["url_encoded_fmt_stream_map","',1)[1].split('"]',1)[0] s_video = escape.json_decode('["%s"]'% s_video)[0].split(',itag=') for v in s_video: itag = v.split('&url=',1)[0] if '=' in itag: itag = itag.rsplit('=',1)[1] if itag in v_format: iurl = v.split('&url=',1)[1].split('&',1)[0] itype = escape.url_unescape(v.split('&type=',1)[1]).split('&',1)[0].split(';',1)[0] video.append({ "url": escape.url_unescape(iurl), "width": int(v_format[itag][0]), "height": int(v_format[itag][1]), "type": itype }) # print(video) # ko cache vi part cache da du 3600s return video # https://plus.google.com/_/photos/lightbox/photo/117469308172362315957/6068501600309862578?soc-app=2&cid=0&soc-platform=1&ozv=es_oz_20141009.12_p1&avw=phst%3A31&f.sid=-7178491292173930655&_reqid=235130&rt=j # https://plus.google.com/photos/103168733314236184036/albums/6063013498393185633/6063426189374545202?pid=6063426189374545202&oid=103168733314236184036 # https://plus.google.com/_/photos/lightbox/photo/117224281821248286118/6072825042706372306 elif 'plus.google.com' in link[:25]: # find cache cache_result = yield self.site.cache.get(source=link, lock=True, lock_count=30) if cache_result and 'data' in cache_result: return cache_result['data'] source = yield function.http_client(link, c_delay=0) # get photoid source = source.split(',"6063426189374545202",',1)[1].split('video.googleusercontent.com',1)[0].split('redirector.googlevideo.com') # print(source) expire = 0 video = [] for i, v in enumerate(source): if i > 0: size = source[i-1].rsplit('[',1)[1].split(',') url = "https://redirector.googlevideo.com" + v.split('"]',1)[0] url = escape.url_unescape(escape.json_decode('["%s"]'% url)[0]) if not expire and 'expire' in url: expire = int(url.split('expire=',1)[1].split('&',1)[0]) video.append({ "url": url, "width": int(size[1]), "height": int(size[2]), "type": "video/mpeg4" }) # store cache cache_time = cache_time + int(time()) if expire > cache_time: self.set_movie_link_cache(link, video, expire - cache_time) return video except: traceback.print_exc(file=sys.stdout)
def get_info(self): try: data = yield http_client(self.link, c_try=5, c_delay=self.delay) data = data.split('<div class="infomovie">', 1)[1] data = data.split('<div id="sidebar">',1)[0].split('<div class="tags">',1)[0] self.movie_view_link = data.split('<a class="link-phim"',1)[1].split('href="',1)[1].split('"',1)[0].strip() # poster poster = data.split('<img src="',1)[1].split('"',1)[0].strip() # title title = data.split(' title="', 1)[1].split('"',1)[0].strip() tmp = title.split(' - ', 1) title = tmp[0].strip() if len(tmp) > 1: subtitle = tmp[1].split('(',1)[0].strip() else: subtitle = "" # director try: director = [d.strip() for d in data.split('<strong>Đạo diễn: </strong><span>',1)[1].split('</span>')[0].split(',')] except: director = [] # stars stars = [d.strip() for d in data.split('<strong>Diễn viên: </strong><span>',1)[1].split('</span>')[0].split(',')] # category category = [d.rsplit(">Phim ", 1)[1].strip() for d in data.split('<strong>Thể loại: </strong>', 1)[1].split('</a></span>',1)[0].split('</a>, <a ')] # country country = data.split('<strong>Quốc gia: </strong>', 1)[1].split('>Phim ',1)[1].split('<',1)[0].strip() # length length = {} try: tmp = data.split('<strong>Thời lượng: </strong><span>', 1)[1].split("</span>",1)[0].strip() length['count'] = int(tmp.split(' ',1)[0].strip()) if 'Phút' in tmp: length['type'] = "short" else: length['type'] = "long" except: pass # year year = data.split('<strong>Năm phát hành: </strong><span>', 1)[1].split("<",1)[0].strip() # description description = data.split('<div class="info-content">',1)[1].strip() ### response = { "poster" : poster, "title" : subtitle, # pass "subtitle" : title, # pass "director" : director, "stars" : stars, "category" : category, "country" : country, "length" : length, "year" : year, "description" : description } print(response) return response except Exception as e: traceback.print_exc(file=sys.stdout)
def get_info(self): try: data = yield http_client(self.link, c_try=5, c_delay=self.delay) data = data.split('<div class="blockbody">', 1)[1] data = data.split('<div class="tags">', 1)[0] # poster poster = "http://phimtructuyenhd.com/" + data.split( '<img class="thumb" src="', 1)[1].split('"', 1)[0].strip() # title title = data.split(' title="', 1)[1].split('"', 1)[0].strip() tmp = title.split(' - ', 1) title = tmp[0].strip() if len(tmp) > 1: subtitle = tmp[1].strip() else: subtitle = "" # year year = data.split('<span class="year">(', 1)[1].split(')</span>', 1)[0].strip() # director try: director = [ d.rsplit(">", 1)[1].strip() for d in data.split('<dt>Đạo diễn:</dt>', 1)[1].split( '</a></dd>', 1)[0].split('</a> ,<a') ] except: traceback.print_exc(file=sys.stdout) director = [] # stars stars = [ d.rsplit(">", 1)[1].strip() for d in data.split('<dt>Diễn viên:</dt>', 1)[1].split( '</a></dd>', 1)[0].split('</a> ,<a') ] # category category = [ d.rsplit(">", 1)[1].strip() for d in data.split('<dt>Thể loại:</dt>', 1)[1].split( '</a></dd>', 1)[0].split('</a> ,<a') ] # country country = data.split('<dt>Quốc gia:</dt><dd>', 1)[1].split("</dd>", 1)[0].strip() # length length = {} tmp = data.split('<dt>Thời lượng:</dt><dd>', 1)[1].split("</dd>", 1)[0].strip() length['count'] = tmp.split(' ', 1)[0].strip() if '/' in length['count']: length['count'] = length['count'].split('/', 1)[1].strip() length['count'] = int(length['count']) if 'Phút' in tmp: length['type'] = "short" else: length['type'] = "long" # description description = data.split(' id="info-film">', 1)[1].rsplit('</div>', 2)[0].strip() ### response = { "poster": poster, "title": subtitle, # pass "subtitle": title, # pass "director": director, "stars": stars, "category": category, "country": country, "length": length, "year": year, "description": description } print(response) return response except Exception as e: traceback.print_exc(file=sys.stdout)
def get_info(self): try: data = yield http_client(self.link, c_try=5, c_delay=self.delay) data = data.split('<div class="intro">', 2)[1].split('</div><!--/.block-->',1)[0] # poster data = data.split('<div class="info">', 2) poster = data[0].split(' src="',2)[1].split('"',1)[0].strip() # title data = data[1].split('<div class="alt1">Đạo diễn', 2) title = data[0].split('color="white">',2)[1].split('<',1)[0].strip() tmp = title.split(' - ', 1) title = tmp[0] subtitle = tmp[1].rsplit(' ', 1)[0] # director data = data[1].split('<div class="alt2">Diễn viên', 2) director = [data[0].split('title="',2)[1].split('"',1)[0].strip()] # stars data = data[1].split('<div class="alt1">Thể loại', 2) temp = data[0].split('</a>,') stars = [] for tmp in temp: tmp = tmp.split('title="',2)[1].split('"',1)[0].strip() stars.append(tmp) # category data = data[1].split('<div class="alt2">Quốc Gia', 2) temp = data[0].split('</a>,') category = [] for tmp in temp: tmp = tmp.split('title="',2)[1].split('"',1)[0].strip() category.append(tmp) # country data = data[1].split('<div class="alt1">Thời lượng:', 2) country = data[0].split('title="Xem Phim ',2)[1].split('"', 1)[0] # length data = data[1].split('<div class="alt2">Năm phát hành:', 2) length = data[0].split('</div>',1)[0].strip() # year data = data[1].split('<div class="alt1">Lượt xem:', 2) year = data[0].split('title="Phim ',2)[1].split('"', 1)[0].strip() # descript_long data = data[1].split('<div class="alt1">Thời lượng:', 2) descript_long = data[0].split('<div class="description">',2)[1].split('<div class="message">',2)[1].split('<div class="title hr"><span>Trailer:',1)[0].rsplit('</div>',1)[0].strip() response = { "poster" : poster, "title" : title, "subtitle" : subtitle, "director" : director, "stars" : stars, "category" : category, "country" : country, "length" : length, "year" : year, "descript_long" : descript_long } return response except Exception as e: traceback.print_exc(file=sys.stdout)
def get_info(self): try: self.data = yield http_client(self.link, c_try=5, c_delay=self.delay) data = self.data.split(" id='thongtinphim'>", 1)[1] data = data.split('<div class="description">',1)[0] # trailer try: trailer =["https://www.youtube.com/watch?v="+data.split('Trailer;phimsohd.y/',1)[1].split('|',1)[0].strip()] except: trailer = "" # poster poster = data.split('<img src="',1)[1].split('"',1)[0].strip() # title title = data.split('<b class="thongtin tenphim">Phim: </b>', 1)[1].split('</h2>',1)[0].strip() tmp = title.split(' - ', 1) title = tmp[0].strip() if len(tmp) > 1: subtitle = tmp[1].strip() else: subtitle = "" # length length = {} try: tmp = data.split('<b class="thongtin">Tập: </b>', 1)[1].split("<br />",1)[0].strip() length['count'] = int(tmp.split(' ',1)[0].strip()) if 'Tập' in tmp: length['type'] = "long" except: length['count'] = 100 length['type'] = "short" # category category = [d.strip() for d in data.split('<b class="thongtin">Thể loại: </b>', 1)[1].split('<br />',1)[0].split(',')] # director director = [] # stars stars = [d.strip() for d in data.split('<b class="thongtin">Thể loại: </b>', 1)[1].split('<br />',1)[0].split(',')] # year year = data.split('<b class="thongtin">Năm PH: </b>',1)[1].split('<br />',1)[0].strip() # country country = data.split('<b class="thongtin">Quốc gia: </b>',1)[1].split('<br />',1)[0].strip() # description description = data.split('<b class="thongtin">Giới thiệu: </b>',1)[1].split('</div>',1)[0].strip() ### response = { "poster" : poster, "title" : subtitle, # pass "subtitle" : title, # pass "trailer" : trailer, "director" : director, "stars" : stars, "category" : category, "country" : country, "length" : length, "year" : year, "description" : description } print(response) return response except Exception as e: traceback.print_exc(file=sys.stdout)
def get_info(self): try: data = yield http_client(self.link, c_try=5, c_delay=self.delay) data = data.split('<div class="cover">', 1)[1] data = data.split('<h4>Liên kết:</h4>',1)[0] # poster data = data.split('<p>Tên phim:', 1) poster = data[0].split('<img src="',1)[1].split('"',1)[0].strip() # title data = data[1].split('<p>Đạo diễn:', 1) title = data[0].split('<span class="fn">',1)[1].split('<',1)[0].strip() tmp = title.split(' - ', 1) title = tmp[0].strip() subtitle = tmp[1].rsplit('(', 1)[0].strip() # director try: data = data[1].split('<p>Diễn viên:', 1) director = [data[0].split("title='",1)[1].split("'",1)[0].strip()] except: traceback.print_exc(file=sys.stdout) director = ["Đang cập nhật"] # stars data = data[1].split('<p>Thể loại:', 1) temp = data[0].split('</a>') stars = [] for tmp in temp: tmp = tmp.split("title='",1) if len(tmp) > 1: tmp = tmp[1].split("'",1)[0].strip() stars.append(tmp) # category data = data[1].split('<p>Quốc gia:', 1) temp = data[0].split('</a>') category = [] for tmp in temp: tmp = tmp.split("title='",1) if len(tmp) > 1: tmp = tmp[1].split("'",1)[0].strip() category.append(tmp) # country data = data[1].split('<p>Thời lượng:', 1) country = data[0].split("title='",1)[1].split("'", 1)[0] # length length = {} data = data[1].split('<p>Năm sản xuất:', 1) tmp = data[0].split('<span>',1)[1].split("</span>",1)[0].strip() print(tmp) length['count'] = int(tmp.split(' ',1)[0].strip()) if 'phút' in tmp: length['type'] = "short" else: length['type'] = "long" # year data = data[1].split('<p>Đánh giá:', 1) year = data[0].split('<span>',1)[1].split("</span>",1)[0].strip() # description data = data[1].split('<div class="alt1">Thời lượng:', 1) description = data[0].split('<div class="entry">',1)[1].split('<p>',1)[1].split('<div class="clear"></div>',1)[0].rsplit('</p>',1)[0].strip() description = "<p>%s</p>" % description ### response = { "poster" : poster, "title" : subtitle, # pass "subtitle" : title, # pass "director" : director, "stars" : stars, "category" : category, "country" : country, "length" : length, "year" : year, "description" : description } print(response) return response except Exception as e: traceback.print_exc(file=sys.stdout)
def get_info(self): try: data = yield http_client(self.link, c_try=5, c_delay=self.delay) data = data.split('<div class="infomovie">', 1)[1] data = data.split('<div id="sidebar">', 1)[0].split('<div class="tags">', 1)[0] self.movie_view_link = data.split( '<a class="link-phim"', 1)[1].split('href="', 1)[1].split('"', 1)[0].strip() # poster poster = data.split('<img src="', 1)[1].split('"', 1)[0].strip() # title title = data.split(' title="', 1)[1].split('"', 1)[0].strip() tmp = title.split(' - ', 1) title = tmp[0].strip() if len(tmp) > 1: subtitle = tmp[1].split('(', 1)[0].strip() else: subtitle = "" # director try: director = [ d.strip() for d in data.split('<strong>Đạo diễn: </strong><span>', 1) [1].split('</span>')[0].split(',') ] except: director = [] # stars stars = [ d.strip() for d in data.split('<strong>Diễn viên: </strong><span>', 1) [1].split('</span>')[0].split(',') ] # category category = [ d.rsplit(">Phim ", 1)[1].strip() for d in data.split('<strong>Thể loại: </strong>', 1)[1].split( '</a></span>', 1)[0].split('</a>, <a ') ] # country country = data.split('<strong>Quốc gia: </strong>', 1)[1].split('>Phim ', 1)[1].split('<', 1)[0].strip() # length length = {} try: tmp = data.split('<strong>Thời lượng: </strong><span>', 1)[1].split("</span>", 1)[0].strip() length['count'] = int(tmp.split(' ', 1)[0].strip()) if 'Phút' in tmp: length['type'] = "short" else: length['type'] = "long" except: pass # year year = data.split('<strong>Năm phát hành: </strong><span>', 1)[1].split("<", 1)[0].strip() # description description = data.split('<div class="info-content">', 1)[1].strip() ### response = { "poster": poster, "title": subtitle, # pass "subtitle": title, # pass "director": director, "stars": stars, "category": category, "country": country, "length": length, "year": year, "description": description } print(response) return response except Exception as e: traceback.print_exc(file=sys.stdout)
def get_info(self): try: data = yield http_client(self.link, c_try=5, c_delay=self.delay) data = data.split('<div class="khung-img">', 1)[1] data = data.split('<div class="bg-main info-movie-contents">', 1)[0] self.movie_view_link = ( data.split('<a class="xemphim"', 1)[1].split(' href="', 1)[1].split('"', 1)[0].strip() ) # poster poster = "http://phimtv.vn/" + data.split('src="', 1)[1].split('"', 1)[0].strip() # trailer try: trailer = [data.split('class="trailer" ', 1)[1].split('rel="', 1)[1].split('"', 1)[0].strip()] except: trailer = "" # title title = data.split('<img alt="', 1)[1].split('"', 1)[0].strip() tmp = title.split(" - ", 1) title = tmp[0].strip() if len(tmp) > 1: subtitle = tmp[1].strip() else: subtitle = "" # director try: director = [ d.rsplit(">", 1)[1].strip() for d in data.split("<h3>Đạo diễn</h3>:", 1)[1].split("</a><br", 1)[0].split("</a>, <a") ] except: traceback.print_exc(file=sys.stdout) director = [] # stars stars = [ d.rsplit(">", 1)[1].strip() for d in data.split("<h3>Diễn viên</h3>:", 1)[1].split("</a><br", 1)[0].split("</a>, <a") ] # country country = data.split("<h3>Quốc gia</h3>:", 1)[1].split("<strong>", 1)[1].split("</strong>", 1)[0].strip() # category category = [ d.rsplit(">", 1)[1].strip() for d in data.split("<h3>Thể loại</h3>:", 1)[1].split("</a><br", 1)[0].split("</a>, <a") ] # year year = data.split("<h3>Năm sản xuất</h3>:", 1)[1].split(">", 1)[1].split("<", 1)[0].strip() # length length = {} tmp = data.split("<h4>Thời lượng</h4>:", 1)[1].split(">", 1)[1].split("<", 1)[0].strip() length["count"] = int(tmp.split(" ", 1)[0].strip()) if "phút" in tmp: length["type"] = "short" else: length["type"] = "long" # description description = ( data.split('<div class="content-info">', 1)[1].split('<div class="trailer-info">', 1)[0].strip() ) ### response = { "poster": poster, "title": subtitle, # pass "subtitle": title, # pass "trailer": trailer, "director": director, "stars": stars, "category": category, "country": country, "length": length, "year": year, "description": description, } print(response) return response except Exception as e: traceback.print_exc(file=sys.stdout)
def get_info(self): try: self.movie_data = yield http_client(self.link, c_try=5, c_delay=self.delay) data = self.movie_data.split('<div class="main_3">', 1)[1] data = data.split('<!-- end collapsible -->',1)[0] # poster poster = "http://xemphim24h.vn" + data.split('src="..',1)[1].split('"',1)[0].strip() # title title = data.split('Phim:</td>', 1)[1].split('>',1)[1].split('<',1)[0].strip() tmp = title.rsplit(' Tập', 1)[0].strip().split(',', 1) title = tmp[0].strip() if len(tmp) > 1: subtitle = tmp[1].strip() else: subtitle = "" # director try: data = data.split('Đạo diễn:</td>', 1) director = [d.strip() for d in data[1].split('">',1)[1].split("<",1)[0].split(',')] except: traceback.print_exc(file=sys.stdout) director = ["Đang cập nhật"] # stars data = data[1].split('Diễn viên:</td>', 1) stars = [d.strip() for d in data[1].split('">',1)[1].split("<",1)[0].split(',')] # category data = data[1].split('Thể loại:</td>', 1) category = [d.strip() for d in data[1].split('">',1)[1].split("<",1)[0].split(',')] # country country = "" # length length = {} data = data[1].split('Tổng số:</td>', 1) tmp = data[1].split('">',1)[1].split("<",1)[0].strip() length['count'] = int(tmp.split(' ',1)[0].strip()) if 'Phút' in tmp: length['type'] = "short" else: length['type'] = "long" # year data = data[1].split('Sản xuất:</td>', 1) year = data[1].split('">',1)[1].split("<",1)[0].strip() # description description = data[1].split('<!-- collapsible -->',1)[1].split('<div class="content">',1)[1].split('<!-- end collapsible -->',1)[0].rsplit('</div>',3)[0].strip() if '<div class="chudenthuong">' in description: description = description.split('<div class="chudenthuong">',1)[1].strip() ### response = { "poster" : poster, "title" : subtitle, # pass "subtitle" : title, # pass "director" : director, "stars" : stars, "category" : category, "country" : country, "length" : length, "year" : year, "description" : description } print(response) return response except Exception as e: traceback.print_exc(file=sys.stdout)
def get_info(self): try: data = yield http_client(self.link, c_try=5, c_delay=self.delay) data = data.split('<div class="info-movie">', 1)[1] data = data.split('<div class="bg-main info-movie-contents">',1)[0] self.movie_view_link = data.split('<div class="play">',1)[1].split('href="',1)[1].split('"',1)[0].strip() # poster poster = data.split('<img src="',1)[1].split('"',1)[0].strip() # trailer try: trailer = [data.split('<a class="xem-trailer"',1)[1].split('rel="',1)[1].split('"',1)[0].strip()] except: trailer = "" # title title = data.split(' title="', 1)[1].split('"',1)[0].strip() tmp = title.split(' - ', 1) title = tmp[0].strip() if len(tmp) > 1: subtitle = tmp[1].strip() else: subtitle = "" # category data = data.split('<p><span>Thể loại:</span>', 1) category = [d.rsplit(">", 1)[1].strip() for d in data[1].split('</a></p>',1)[0].split('</a>,')] # director try: data = data.split('<p><span>Đạo diễn:</span>', 1) director = [d.rsplit(">",1)[1].strip() for d in data[1].split('</a></p>',1)[0].split('</a>')] except: traceback.print_exc(file=sys.stdout) director = ["Đang cập nhật"] # stars data = data[1].split('<p><span>Diễn viên:</span>', 1) stars = [d.rsplit(">",1)[1].strip() for d in data[1].split('</a></p>',1)[0].split('</a>')] # year data = data[1].split('<p><span>Năm phát hành:</span>', 1) year = data[1].split("</p>",1)[0].strip() # length length = {} data = data[1].split('<p><span>Thời lượng:</span>', 1) tmp = data[1].split("</p>",1)[0].strip() length['count'] = int(tmp.split(' ',1)[0].strip()) if 'phút' in tmp: length['type'] = "short" else: length['type'] = "long" # country data = data[1].split('<p><span>Quốc gia:</span>', 1) country = data[1].split("</p>",1)[0].strip() # description description = data[1].split('<div class="lbox icontents">',1)[1].split('</div>',1)[0].strip() ### response = { "poster" : poster, "title" : subtitle, # pass "subtitle" : title, # pass "trailer" : trailer, "director" : director, "stars" : stars, "category" : category, "country" : country, "length" : length, "year" : year, "description" : description } print(response) return response except Exception as e: traceback.print_exc(file=sys.stdout)
def get_info(self): try: data = yield http_client(self.link, c_try=5, c_delay=self.delay) data = data.split('<div class="cover">', 1)[1] data = data.split('<!-- container --><script>',1)[0] # poster poster = data.split('<img src="',1)[1].split('"',1)[0].strip() # title data = data.split('<p>Tên phim:', 1) title = data[1].split('<span class="fn">',1)[1].split('<',1)[0].strip() tmp = title.split(' - ', 1) title = tmp[0].strip() subtitle = tmp[1].rsplit(' - ', 1)[0].strip() # director try: data = data[1].split('<p>Đạo diễn:', 1) director = [data[1].split('">',1)[1].split("</a>",1)[0].strip()] except: traceback.print_exc(file=sys.stdout) director = ["Đang cập nhật"] # stars data = data[1].split('<p>Diễn viên:', 1) temp = data[1].split('</span></p>',1)[0].split('</a>') stars = [] for tmp in temp: tmp = tmp.split('">',1) if len(tmp) > 1: tmp = tmp[1].split("</a>",1)[0].strip() stars.append(tmp) # category data = data[1].split('<p>Thể loại:', 1) temp = data[1].split('</span></p>',1)[0].split('</a>') category = [] for tmp in temp: tmp = tmp.split('">',1) if len(tmp) > 1: tmp = tmp[1].split("</a>",1)[0].strip() category.append(tmp) # country data = data[1].split('<p>Quốc gia:', 1) country = data[1].split('">',1)[1].split("</a>",1)[0].strip() # length length = {} data = data[1].split('<p>Thời lượng:', 1) tmp = data[1].split('<span>',1)[1].split("</span>",1)[0].strip() length['count'] = int(tmp.split(' ',1)[0].strip()) if 'phút' in tmp.lower(): length['type'] = "short" else: length['type'] = "long" try: imdb = float(data[1].split('<span class="average">',1)[1].split('<',1)[0]) if imdb == 9.5: imdb = 0 except: imdb = 0 # year data = data[1].split('<p>Năm phát hành:', 1) year = data[1].split('">',1)[1].split("</a>",1)[0].strip() # description description = data[1].split('<div class="entry">',1)[1].split('<div class="clear"></div>',1)[0].rsplit('</div>',1)[0].strip() if '<p style="text-align: justify;">' in description: description = description.split('<p style="text-align: justify;">',1)[1].rsplit('</p>',1)[0].strip(); ### try: image = [x.split('"',1)[0] for x in description.split('<img src="',1)[1].rsplit('" alt=""/>',1)[0].split('<img src="')] except: image = [] response = { "poster" : poster, "title" : subtitle, # pass "subtitle" : title, # pass "director" : director, "stars" : stars, "category" : category, "country" : country, "length" : length, "year" : year, "imdb" : imdb, "image" : image, "description" : description } # print(response) return response except Exception as e: traceback.print_exc(file=sys.stdout)
def get_info(self): try: data = yield http_client(self.link, c_try=5, c_delay=self.delay) data = data.split('<div class="khung-img">', 1)[1] data = data.split('<div class="bg-main info-movie-contents">', 1)[0] self.movie_view_link = data.split( '<a class="xemphim"', 1)[1].split(' href="', 1)[1].split('"', 1)[0].strip() # poster poster = "http://phimtv.vn/" + data.split('src="', 1)[1].split( '"', 1)[0].strip() # trailer try: trailer = [ data.split('class="trailer" ', 1)[1].split('rel="', 1)[1].split('"', 1)[0].strip() ] except: trailer = "" # title title = data.split('<img alt="', 1)[1].split('"', 1)[0].strip() tmp = title.split(' - ', 1) title = tmp[0].strip() if len(tmp) > 1: subtitle = tmp[1].strip() else: subtitle = "" # director try: director = [ d.rsplit(">", 1)[1].strip() for d in data.split('<h3>Đạo diễn</h3>:', 1)[1].split( '</a><br', 1)[0].split('</a>, <a') ] except: traceback.print_exc(file=sys.stdout) director = [] # stars stars = [ d.rsplit(">", 1)[1].strip() for d in data.split('<h3>Diễn viên</h3>:', 1)[1].split( '</a><br', 1)[0].split('</a>, <a') ] # country country = data.split('<h3>Quốc gia</h3>:', 1)[1].split('<strong>', 1)[1].split("</strong>", 1)[0].strip() # category category = [ d.rsplit(">", 1)[1].strip() for d in data.split('<h3>Thể loại</h3>:', 1)[1].split( '</a><br', 1)[0].split('</a>, <a') ] # year year = data.split('<h3>Năm sản xuất</h3>:', 1)[1].split('>', 1)[1].split("<", 1)[0].strip() # length length = {} tmp = data.split('<h4>Thời lượng</h4>:', 1)[1].split('>', 1)[1].split("<", 1)[0].strip() length['count'] = int(tmp.split(' ', 1)[0].strip()) if 'phút' in tmp: length['type'] = "short" else: length['type'] = "long" # description description = data.split('<div class="content-info">', 1)[1].split('<div class="trailer-info">', 1)[0].strip() ### response = { "poster": poster, "title": subtitle, # pass "subtitle": title, # pass "trailer": trailer, "director": director, "stars": stars, "category": category, "country": country, "length": length, "year": year, "description": description } print(response) return response except Exception as e: traceback.print_exc(file=sys.stdout)
def get_info(self): try: self.movie_data = yield http_client(self.link, c_try=5, c_delay=self.delay) data = self.movie_data.split('<div class="main_3">', 1)[1] data = data.split('<!-- end collapsible -->', 1)[0] # poster poster = "http://xemphim24h.vn" + data.split( 'src="..', 1)[1].split('"', 1)[0].strip() # title title = data.split('Phim:</td>', 1)[1].split('>', 1)[1].split('<', 1)[0].strip() tmp = title.rsplit(' Tập', 1)[0].strip().split(',', 1) title = tmp[0].strip() if len(tmp) > 1: subtitle = tmp[1].strip() else: subtitle = "" # director try: data = data.split('Đạo diễn:</td>', 1) director = [ d.strip() for d in data[1].split('">', 1)[1].split("<", 1) [0].split(',') ] except: traceback.print_exc(file=sys.stdout) director = ["Đang cập nhật"] # stars data = data[1].split('Diễn viên:</td>', 1) stars = [ d.strip() for d in data[1].split('">', 1)[1].split("<", 1)[0].split(',') ] # category data = data[1].split('Thể loại:</td>', 1) category = [ d.strip() for d in data[1].split('">', 1)[1].split("<", 1)[0].split(',') ] # country country = "" # length length = {} data = data[1].split('Tổng số:</td>', 1) tmp = data[1].split('">', 1)[1].split("<", 1)[0].strip() length['count'] = int(tmp.split(' ', 1)[0].strip()) if 'Phút' in tmp: length['type'] = "short" else: length['type'] = "long" # year data = data[1].split('Sản xuất:</td>', 1) year = data[1].split('">', 1)[1].split("<", 1)[0].strip() # description description = data[1].split('<!-- collapsible -->', 1)[1].split( '<div class="content">', 1)[1].split('<!-- end collapsible -->', 1)[0].rsplit('</div>', 3)[0].strip() if '<div class="chudenthuong">' in description: description = description.split('<div class="chudenthuong">', 1)[1].strip() ### response = { "poster": poster, "title": subtitle, # pass "subtitle": title, # pass "director": director, "stars": stars, "category": category, "country": country, "length": length, "year": year, "description": description } print(response) return response except Exception as e: traceback.print_exc(file=sys.stdout)
def part_link(self, g_movie, link=None): try: if '.google.com' in g_movie[:28]: u_id = "" p_id = "" u_auth = "" if 'picasaweb' in g_movie[:18]: if '#' in g_movie: regex = re.compile("https://picasaweb.google.com/([a-z0-9]+)/(.*?)authkey=([a-zA-Z0-9\-\_\+]+)(.*?)#([a-z0-9]+)") r = regex.search(g_movie) if r: lst = r.groups() u_id = lst[0] u_auth = lst[2] p_id = lst[4] else: print('\n\n\n\n mvi',g_movie) regex = re.compile("https://picasaweb.google.com/([a-z0-9]+)/(.*?)#([a-z0-9]+)") # https://picasaweb.google.com/106316564981908873085/Vsub?noredirect=1#6060808208011471442 r = regex.search(g_movie) lst = r.groups() u_id = lst[0] p_id = lst[2] elif "/lh/photo/" in g_movie: data = yield function.http_client(g_movie, c_try=5, c_delay=3) # regex = re.compile(r"\:\\x2F\\x2Fplus\.google\.com\\x2Fphotos\\x2F([a-zA-Z0-9]+)\\x2Fphoto\\x2F([a-zA-Z0-9]+)\?") regex = re.compile(r"picasaweb.google.com/data/feed/tiny/user/([0-9]+)/photoid/([0-9]+)\?(.*?)\"") r = regex.search(data) lst = r.groups() return "https://picasaweb.google.com/data/feed/tiny/user/%s/photoid/%s?%s" % (lst[0],lst[1],lst[2]) else: data = yield function.http_client(g_movie, c_try=5, c_delay=3) regex = re.compile("\"(https://picasaweb.google.com/data/feed/tiny/user/([a-z0-9]+)/albumid/([a-z0-9]+)/photoid/([a-z0-9]+)(.*?))\"") r = regex.search(data) lst = r.groups() mv = lst[0] u_id = mv.split('tiny/user/', 1)[1].split('/',1)[0] p_id = mv.split('photoid/', 1)[1].split('/',1)[0].split('?',1)[0] try: u_auth = mv.split('authkey=', 1)[1].split('/',1)[0].split('?',1)[0].split('&',1)[0] except Exception as e: print('authen key error', self, e) g_link = "https://picasaweb.google.com/data/feed/tiny/user/%s/photoid/%s?alt=jsonm" % (u_id, p_id) if len(u_auth) > 0: g_link = "%s&authkey=%s" % (g_link, u_auth) return g_link elif 'docs' in g_movie[:12]: return g_movie elif 'youtube.com' in g_movie[:28] or 'youtu.be' in g_movie[:15]: return g_movie elif 'clip.vn' in g_movie[:28]: return g_movie elif 'tv.zing.vn' in g_movie[:28]: return g_movie except Exception as e: traceback.print_exc(file=sys.stdout) return None
def get_info(self): try: data = yield http_client(self.link, c_try=5, c_delay=self.delay) data = data.split('<div class="thumbcontent">', 1)[1] data = data.split('</div>\n</div>\n</div>\n',1)[0] # poster poster = "http://phimhay365.com" + data.split(' src="',1)[1].split('"',1)[0].strip() # title print(data) title = data.split('<span class="key">Tên Phim:</span>', 1)[1].split('">',1)[1].split('<',1)[0].strip() subtitle = "" # director try: data = data.split('<span class="key">Đạo diễn:</span>', 1) tmp = data[1].split('">',1)[1].split('<',1)[0].strip() director = [d.strip() for d in tmp.split(',')] except: traceback.print_exc(file=sys.stdout) director = ["Đang cập nhật"] # stars data = data[1].split('<span class="key">Diễn viên:</span>', 1) tmp = data[1].split('">',1)[1].split('<',1)[0].strip() stars = [d.strip() for d in tmp.split(',')] # length try: length = {} data = data[1].split('<span class="key">Thời Lượng:</span>', 1) tmp = data[1].split('">',1)[1].split('<',1)[0].strip() length['count'] = int(tmp.split(' ',1)[0].strip()) if 'phút' in tmp: length['type'] = "short" else: length['type'] = "long" except: length = "" # category tmp = data[1].split('<span class="key">Thể loại:</span>', 1) category = [d.rsplit(">", 1)[1].strip() for d in tmp[1].split('</a></span>',1)[0].split('</a>,')] # year print('\n\n\n', data) data = data[1].split('Năm Phát Hành:</span>', 1) year = data[1].split('">',1)[1].split('<',1)[0].strip() # country country = "" # description description = data[1].split('<div id="gach_ngang" class="box_des">',1)[1].split('</div>',1)[0].strip() ### response = { "poster" : poster, "title" : subtitle, # pass "subtitle" : title, # pass "director" : director, "stars" : stars, "category" : category, "country" : country, "length" : length, "year" : year, "description" : description } print(response) return response except Exception as e: traceback.print_exc(file=sys.stdout)
def get_info(self): try: data = yield http_client(self.link, c_try=5, c_delay=self.delay) data = data.split('<div class="cover">', 1)[1] data = data.split('<!-- container --><script>', 1)[0] # poster poster = data.split('<img src="', 1)[1].split('"', 1)[0].strip() # title data = data.split('<p>Tên phim:', 1) title = data[1].split('<span class="fn">', 1)[1].split('<', 1)[0].strip() tmp = title.split(' - ', 1) title = tmp[0].strip() subtitle = tmp[1].rsplit(' - ', 1)[0].strip() # director try: data = data[1].split('<p>Đạo diễn:', 1) director = [ data[1].split('">', 1)[1].split("</a>", 1)[0].strip() ] except: traceback.print_exc(file=sys.stdout) director = ["Đang cập nhật"] # stars data = data[1].split('<p>Diễn viên:', 1) temp = data[1].split('</span></p>', 1)[0].split('</a>') stars = [] for tmp in temp: tmp = tmp.split('">', 1) if len(tmp) > 1: tmp = tmp[1].split("</a>", 1)[0].strip() stars.append(tmp) # category data = data[1].split('<p>Thể loại:', 1) temp = data[1].split('</span></p>', 1)[0].split('</a>') category = [] for tmp in temp: tmp = tmp.split('">', 1) if len(tmp) > 1: tmp = tmp[1].split("</a>", 1)[0].strip() category.append(tmp) # country data = data[1].split('<p>Quốc gia:', 1) country = data[1].split('">', 1)[1].split("</a>", 1)[0].strip() # length length = {} data = data[1].split('<p>Thời lượng:', 1) tmp = data[1].split('<span>', 1)[1].split("</span>", 1)[0].strip() length['count'] = int(tmp.split(' ', 1)[0].strip()) if 'phút' in tmp.lower(): length['type'] = "short" else: length['type'] = "long" try: imdb = float(data[1].split('<span class="average">', 1)[1].split('<', 1)[0]) if imdb == 9.5: imdb = 0 except: imdb = 0 # year data = data[1].split('<p>Năm phát hành:', 1) year = data[1].split('">', 1)[1].split("</a>", 1)[0].strip() # description description = data[1].split('<div class="entry">', 1)[1].split( '<div class="clear"></div>', 1)[0].rsplit('</div>', 1)[0].strip() if '<p style="text-align: justify;">' in description: description = description.split( '<p style="text-align: justify;">', 1)[1].rsplit('</p>', 1)[0].strip() ### try: image = [ x.split('"', 1)[0] for x in description.split('<img src="', 1)[1].rsplit( '" alt=""/>', 1)[0].split('<img src="') ] except: image = [] response = { "poster": poster, "title": subtitle, # pass "subtitle": title, # pass "director": director, "stars": stars, "category": category, "country": country, "length": length, "year": year, "imdb": imdb, "image": image, "description": description } # print(response) return response except Exception as e: traceback.print_exc(file=sys.stdout)
def get_info(self): try: data = yield http_client(self.link, c_try=5, c_delay=self.delay) data = data.split('<div class="blockbody">', 1)[1] data = data.split('<div class="tags">', 1)[0] # poster poster = ( "http://phimtructuyenhd.com/" + data.split('<img class="thumb" src="', 1)[1].split('"', 1)[0].strip() ) # title title = data.split(' title="', 1)[1].split('"', 1)[0].strip() tmp = title.split(" - ", 1) title = tmp[0].strip() if len(tmp) > 1: subtitle = tmp[1].strip() else: subtitle = "" # year year = data.split('<span class="year">(', 1)[1].split(")</span>", 1)[0].strip() # director try: director = [ d.rsplit(">", 1)[1].strip() for d in data.split("<dt>Đạo diễn:</dt>", 1)[1].split("</a></dd>", 1)[0].split("</a> ,<a") ] except: traceback.print_exc(file=sys.stdout) director = [] # stars stars = [ d.rsplit(">", 1)[1].strip() for d in data.split("<dt>Diễn viên:</dt>", 1)[1].split("</a></dd>", 1)[0].split("</a> ,<a") ] # category category = [ d.rsplit(">", 1)[1].strip() for d in data.split("<dt>Thể loại:</dt>", 1)[1].split("</a></dd>", 1)[0].split("</a> ,<a") ] # country country = data.split("<dt>Quốc gia:</dt><dd>", 1)[1].split("</dd>", 1)[0].strip() # length length = {} tmp = data.split("<dt>Thời lượng:</dt><dd>", 1)[1].split("</dd>", 1)[0].strip() length["count"] = tmp.split(" ", 1)[0].strip() if "/" in length["count"]: length["count"] = length["count"].split("/", 1)[1].strip() length["count"] = int(length["count"]) if "Phút" in tmp: length["type"] = "short" else: length["type"] = "long" # description description = data.split(' id="info-film">', 1)[1].rsplit("</div>", 2)[0].strip() ### response = { "poster": poster, "title": subtitle, # pass "subtitle": title, # pass "director": director, "stars": stars, "category": category, "country": country, "length": length, "year": year, "description": description, } print(response) return response except Exception as e: traceback.print_exc(file=sys.stdout)