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 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 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 ])