예제 #1
0
    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
예제 #2
0
    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
예제 #3
0
파일: etigoya.py 프로젝트: wc-itdog/JavPy
    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
예제 #4
0
    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
예제 #5
0
 def get_actress_info(actress):
     return wait_until([
         submit(source.get_actress_info, actress)
         for source in Sources.ActressInfo
     ])
예제 #6
0
 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)
예제 #7
0
 def translate2jp(actress):
     return wait_until([
         submit(source.translate2jp, actress)
         for source in Sources.TranslateEn2Jp
     ])