コード例 #1
0
    def get_newly_released(cls, page):
        major_info_req = Task(cls.__client.get, "http://www.javlibrary.com/cn/vl_newrelease.php?mode=2&page=%d" % page)
        dates_req = Task(cls.__client.get, "http://www.javlibrary.com/cn/vl_newrelease.php?list&mode=2&page=%d" % page)
        major_info_rsp, dates_rsp = spawn_many((major_info_req, dates_req)).wait_for_all_finished()
        major_info = cls.parse_major_info(major_info_rsp)
        dates = map(lambda d: datetime.datetime.strptime(d, "%Y-%m-%d"), filter(
            lambda x: "-" in x, re.findall("<td>(.+?)</td>", dates_rsp.text)
        ))

        for i, date in enumerate(dates):
            major_info[i].release_date = date
        return major_info
コード例 #2
0
ファイル: history_names.py プロジェクト: tsw520/JavPy
 def get_history_names(actress):
     result = list(
         filter(
             lambda x: x,
             spawn_many((Task(Etigoya.get_history_names, actress),
                         Task(AVHelpMemoWiki.get_history_names,
                              actress))).wait_for_all_finished()))
     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)))
コード例 #3
0
 def search_by_code(code):
     av, brief_info = spawn_many(
         (Task(Search.search_by_code,
               code), Task(Functions.get_brief,
                           code))).wait_for_all_finished()
     if av:
         res = av
         if brief_info:
             res.actress = brief_info.actress if brief_info.actress else ""
             res.set_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
コード例 #4
0
 def translate2jp(actress):
     return list(
         filter(
             lambda x: x,
             spawn_many([
                 Task(source.translate2jp, actress)
                 for source in ActressTranslate.sources_en2jp
             ]).wait_for_one_finished()))[0]
コード例 #5
0
ファイル: ping.py プロジェクト: necoic/JavPy
def ping(url, n=1):
    latencies = list(
        map(
            lambda rsp: rsp.elapsed.microseconds,
            filter(
                lambda rsp: rsp.status_code == 200,
                spawn_many((Task(requests.head, url)
                            for _ in range(n))).wait_for_all_finished())))
    return 0 if not latencies else sum(latencies) / len(latencies)
コード例 #6
0
ファイル: actress_translate.py プロジェクト: necoic/JavPy
 def translate2jp(actress):
     res = list(
         filter(
             lambda x: x,
             spawn_many([
                 Task(source.translate2jp, actress)
                 for source in Sources.TranslateEn2Jp
             ]).wait_for_one_finished(),
         ))
     if not res:
         return None
     else:
         return res[0]
コード例 #7
0
ファイル: history_names.py プロジェクト: necoic/JavPy
 def get_history_names(actress):
     result = list(
         filter(
             lambda x: x,
             spawn_many((Task(source.get_history_names, actress)
                         for source in Sources.HistoryNames
                         )).wait_for_all_finished(),
         ))
     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)))
コード例 #8
0
ファイル: etigoya.py プロジェクト: tho-can-code/JavPy
    def get_history_names(cls, actress):
        url = "http://etigoya955.blog49.fc2.com/?q=" + actress + "&charset=utf-8"
        html = requests.get(url).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 = spawn_many(
            (Task(cls.get_history_names_by_li, li)
             for li in lis)).wait_until(lambda rsp: actress in rsp)
        res = next(filter(lambda names: names and actress in names, res))

        return res
コード例 #9
0
ファイル: search_by_actress.py プロジェクト: squallnk/JavPy
    def search(cls, actress, up_to, history_name=False):
        lang = cls.__guess_lang(actress)

        if lang == "en":
            actress = ActressTranslate.translate2jp(actress)
        if actress:
            movies = spawn_many(
                Task(source.search_by_actress, actress, up_to)
                for source in Sources.SearchByActress)
            if history_name:
                names = spawn(HistoryNames.get_history_names, actress)
                result = movies.wait_for_one_finished(), names.wait_for_result(
                )
            else:
                result = movies.wait_for_one_finished(), None

            return result[0][0], result[1]
        else:
            return [], None
コード例 #10
0
 def get_actress_info(actress):
     return spawn_many(
         (Task(source.get_actress_info, actress)
          for source in ActressInfo.sources)).wait_for_one_finished()
コード例 #11
0
 def search_by_code(cls, code):
     res = spawn_many((Task(source.search_by_code, code)
                       for source in cls.sources_by_code
                       )).wait_until(lambda x: x.preview_img_url)
     return sum_up(res)
コード例 #12
0
 def search(cls, code) -> AV:
     res = spawn_many((Task(source.search_by_code, code)
                       for source in Sources.SearchByCode
                       )).wait_until(lambda x: x.preview_img_url)
     return sum_up(res)
コード例 #13
0
ファイル: brief.py プロジェクト: tsw520/JavPy
 def get_brief(code):
     return sum_up(spawn_many(
         (Task(source.get_brief, code) for source in Brief.sources)
     ).wait_until(lambda res: res.preview_img_url))
コード例 #14
0
 def get_brief(code):
     return conclude(
         spawn_many(
             (Task(source.get_brief, code) for source in Sources.Brief
              )).wait_until(lambda res: res.preview_img_url))