Closed broken2211 closed 2 months ago
`@logger.catch() async def search_images() -> None: async with Network(proxies=proxies, bypass=bypass, verify_ssl=verify_ssl) as client:
ascii2d = Ascii2D(client=client, bovw=bovw) ascii2d_resp = await ascii2d.search(file=file) show_result(ascii2d_resp, "Ascii2D") # Google 搜索 google = Google(client=client) google_resp = await google.search(file=file) show_result(google_resp, "Google") # Baidu 搜索 baidu = BaiDu(client=client) baidu_resp = await baidu.search(file=file) show_result(baidu_resp, "Baidu") # EHentai 搜索 ehentai = EHentai(client=client) ehentai_resp = await ehentai.search(file=file, ex=ex) show_result(ehentai_resp, "EHentai") # Iqdb 搜索 iqdb = Iqdb(client=client) iqdb_resp = await iqdb.search(file=file) show_result(iqdb_resp, "Iqdb") # SauceNAO 搜索 saucenao = SauceNAO(client=client) saucenao_resp = await saucenao.search(file=file, api_key=api_key, hide=3) show_result(saucenao_resp, "SauceNAO") # TraceMoe 搜索 tracemoe = TraceMoe(client=client) tracemoe_resp = await tracemoe.search(file=file, mute=False, size=None) show_result(tracemoe_resp, "TraceMoe") # Yandex 搜索 yandex = Yandex(client=client) yandex_resp = await yandex.search(file=file) show_result(yandex_resp, "Yandex")
def show_result(resp, engine_name) -> None: logger.info(f"Results from {engine_name}:") logger.info(resp.url) selected = next((i for i in resp.raw if i.title or i.url_list), resp.raw[1]) logger.info(selected.origin) logger.info(selected.thumbnail) logger.info(selected.title) logger.info(selected.author) logger.info(selected.author_url) logger.info(selected.url) logger.info(selected.url_list) logger.info(selected.hash) logger.info(selected.detail) logger.info("-" * 50)
if name == "main": loop = asyncio.get_event_loop() loop.run_until_complete(search_images()) `就是我是使用php的shell_exec执行python,然后返回的结果为null,不太理解,求救大佬
搞定了
`@logger.catch() async def search_images() -> None: async with Network(proxies=proxies, bypass=bypass, verify_ssl=verify_ssl) as client:
Ascii2D 搜索
def show_result(resp, engine_name) -> None: logger.info(f"Results from {engine_name}:") logger.info(resp.url) selected = next((i for i in resp.raw if i.title or i.url_list), resp.raw[1]) logger.info(selected.origin) logger.info(selected.thumbnail) logger.info(selected.title) logger.info(selected.author) logger.info(selected.author_url) logger.info(selected.url) logger.info(selected.url_list) logger.info(selected.hash) logger.info(selected.detail) logger.info("-" * 50)
if name == "main": loop = asyncio.get_event_loop() loop.run_until_complete(search_images()) `就是我是使用php的shell_exec执行python,然后返回的结果为null,不太理解,求救大佬