def search(cls, actress, up_to, with_profile=False): lang = cls.__guess_lang(actress) if lang == "en": actress = ActressTranslate.translate2jp(actress) if actress: videos = [ submit(source.search_by_actress, actress, up_to) for source in Sources.SearchByActress ] if with_profile: profile = submit(ActressInfo.get_actress_info, actress) names = submit(HistoryNames.get_history_names, actress) names = names.result() profile = profile.result() print(profile) if profile is None: profile = Actress() profile.other["history_names"] = names else: profile.other["history_names"] = list( set(names).union(set(profile.other["history_names"])) ) return wait_until(videos), profile else: return wait_until(videos), None return [], None
def search(cls, actress, up_to, history_name=False): lang = cls.__guess_lang(actress) if lang == "en": actress = ActressTranslate.translate2jp(actress) if actress: videos = [ submit(source.search_by_actress, actress, up_to) for source in Sources.SearchByActress ] if history_name: names = submit(HistoryNames.get_history_names, actress) return wait_until(videos), names.result() else: return wait_until(videos), None
def search_by_code(code): av = submit(SearchByCode.search, code) brief_info = submit(Functions.get_brief, code) av = av.result() if av: res = av brief_info = brief_info.result() if brief_info: res.actress = brief_info.actress if brief_info.actress else "" res.release_date = brief_info.release_date res.title = brief_info.title res.preview_img_url = (brief_info.preview_img_url if brief_info.preview_img_url else "") return res else: return None
def get_newly_released(mcs, page): major_info_req = submit( mcs.__client.get, "http://www.javlibrary.com/cn/vl_newrelease.php?mode=2&page=%d" % page, proxies=proxy ) dates_req = submit( mcs.__client.get, "http://www.javlibrary.com/cn/vl_newrelease.php?list&mode=2&page=%d" % page, proxies=proxy ) major_info = mcs.parse_major_info(major_info_req.result()) dates = map( lambda d: datetime.datetime.strptime(d, "%Y-%m-%d"), filter(lambda x: "-" in x, re.findall("<td>(.+?)</td>", dates_req.result().text)), ) for i, date in enumerate(dates): major_info[i].release_date = date return major_info
def get_history_names(actress): result = list( filter( lambda x: x, wait_for_all([submit(src.get_history_names, actress) for src in Sources.HistoryNames]) ) ) if len(result) == 0: return [] if len(result) == 1: return result[0] else: return list(reduce(lambda x, y: x.union(y), map(lambda z: set(z), result)))
def get_history_names(mcs, actress): url = "http://etigoya955.blog49.fc2.com/?q=" + actress + "&charset=utf-8" html = requests.get(url, proxies=proxy).text bs = bs4.BeautifulSoup(html, "lxml") main = bs.select("#main")[0] lis = main.select("li", limit=1) if len(lis) == 1 and "スポンサー広告" in str(lis[0]): return [] res = wait_until( [submit(mcs.get_history_names_by_li, li) for li in lis], condition=lambda rsp: actress in rsp) return res
def search_by_code(mcs, code): url = "http://www5.javmost.com/" + code + "/" main_rsp = mcs.__client.get(url, proxies=proxy) if main_rsp.status_code != 200: return None img = noexcept( lambda: re.search(r"<meta property=\"og:image\" content=\"(.+?)\"", main_rsp.text).group(1)) if not img: return None # Nov. 13 adding: https://www5.javmost.com/IENE-623/ if not img.startswith("http:"): img = "http:" + img bs = bs4.BeautifulSoup(main_rsp.text, "lxml") buttons = bs.select(".tab-overflow")[0].find_all(name="li")[1:-1] var_value = re.search("'value':(.+?),", main_rsp.text).group(1) value = re.search("var %s = '(.+?)'" % var_value, main_rsp.text).group(1) url = wait_until([ submit(mcs.__try_one_button, button, value, main_rsp) for button in buttons ]) if not url: return None av = AV() av.preview_img_url = img av.video_url = url av.code = code return av
def search_by_actress(mcs, actress, up_to): url = "https://indexav.com/actor/" + actress rsp = requests.get(url, verify=False, proxies=proxy) bs = bs4.BeautifulSoup(rsp.text, "lxml") ul = bs.select(".pagination-list") if len(ul) == 0: return mcs.__search_by_actress_in_page(actress, 1) else: return reduce( lambda x1, x2: x1 + x2, filter( lambda x: x, wait_for_all( [ submit( mcs.__search_by_actress_in_page, actress, int(page.text.strip()), ) for page in ul[0].find_all("li") ] ), ), )
def get_actress_info(actress): return wait_until([ submit(source.get_actress_info, actress) for source in Sources.ActressInfo ])
def search(cls, code) -> AV: return wait_until( [submit(x.search_by_code, code) for x in Sources.SearchByCode], condition=lambda x: x.video_url)
def translate2jp(actress): return wait_until([ submit(source.translate2jp, actress) for source in Sources.TranslateEn2Jp ])
def get_magnet(code): return submit(Magnet.get_magnet, code).result()
def get_brief(code): return conclude( wait_for_all( [submit(source.get_brief, code) for source in Sources.Brief]))