Demo
# Demo
# 示例
import asyncio
from loguru import logger
from PicImageSearch import Network, TraceMoe
from PicImageSearch.model import TraceMoeResponse
# proxies = "http://127.0.0.1:1081"
proxies = None
url = "https://raw.githubusercontent.com/kitUIN/PicImageSearch/main/demo/images/test05.jpg"
file = "images/test05.jpg"
bypass = False # 是否绕过 DNS 污染
@logger.catch()
async def test_async() -> None:
async with Network(proxies=proxies, bypass=bypass) as client:
tracemoe = TraceMoe(client=client, mute=False, size=None)
# resp = await tracemoe.search(url=url)
resp = await tracemoe.search(file=file)
show_result(resp)
def show_result(resp: TraceMoeResponse) -> None:
# logger.info(resp.origin) # 原始数据
logger.info(resp.raw[0].origin)
logger.info(resp.raw[0].anime_info)
logger.info(resp.frameCount)
logger.info(resp.raw[0].anilist)
logger.info(resp.raw[0].idMal)
logger.info(resp.raw[0].title_native)
logger.info(resp.raw[0].title_romaji)
logger.info(resp.raw[0].title_english)
logger.info(resp.raw[0].title_chinese)
logger.info(resp.raw[0].synonyms)
logger.info(resp.raw[0].isAdult)
logger.info(resp.raw[0].type)
logger.info(resp.raw[0].format)
logger.info(resp.raw[0].start_date)
logger.info(resp.raw[0].end_date)
logger.info(resp.raw[0].cover_image)
logger.info(resp.raw[0].filename)
logger.info(resp.raw[0].episode)
logger.info(resp.raw[0].From)
logger.info(resp.raw[0].To)
logger.info(resp.raw[0].similarity)
logger.info(resp.raw[0].video)
logger.info(resp.raw[0].image)
if __name__ == "__main__":
loop = asyncio.get_event_loop()
loop.run_until_complete(test_async())
import asyncio
from loguru import logger
from PicImageSearch import Network, TraceMoe
from PicImageSearch.model import TraceMoeResponse
from PicImageSearch.sync import TraceMoe as TraceMoeSync
# proxies = "http://127.0.0.1:1081"
proxies = None
url = "https://raw.githubusercontent.com/kitUIN/PicImageSearch/main/demo/images/test05.jpg"
file = "images/test05.jpg"
bypass = False # 是否绕过 DNS 污染
@logger.catch()
def test_sync() -> None:
tracemoe = TraceMoeSync(proxies=proxies, bypass=bypass, mute=False, size=None)
resp = tracemoe.search(url=url)
# resp = tracemoe.search(file=file)
show_result(resp) # type: ignore
def show_result(resp: TraceMoeResponse) -> None:
# logger.info(resp.origin) # 原始数据
logger.info(resp.raw[0].origin)
logger.info(resp.raw[0].anime_info)
logger.info(resp.frameCount)
logger.info(resp.raw[0].anilist)
logger.info(resp.raw[0].idMal)
logger.info(resp.raw[0].title_native)
logger.info(resp.raw[0].title_romaji)
logger.info(resp.raw[0].title_english)
logger.info(resp.raw[0].title_chinese)
logger.info(resp.raw[0].synonyms)
logger.info(resp.raw[0].isAdult)
logger.info(resp.raw[0].type)
logger.info(resp.raw[0].format)
logger.info(resp.raw[0].start_date)
logger.info(resp.raw[0].end_date)
logger.info(resp.raw[0].cover_image)
logger.info(resp.raw[0].filename)
logger.info(resp.raw[0].episode)
logger.info(resp.raw[0].From)
logger.info(resp.raw[0].To)
logger.info(resp.raw[0].similarity)
logger.info(resp.raw[0].video)
logger.info(resp.raw[0].image)
if __name__ == "__main__":
test_sync()
// Make sure to add code blocks to your code group
- name: 前往查看
desc: 🚀 测试文件 Demo
link: https://github.com/kitUIN/PicImageSearch/blob/main/demo/cn/demo_tracemoe.py
bgColor: '#DFEEE7'
textColor: '#2A3344'
程序输出
2022-10-06 01:14:27.739 | INFO | __main__:show_result:35 - {'anilist': 11887, 'filename': 'Kokoro Connect - 05 (BD 1280x720 x264 AACx2).mp4', 'episode': 5, 'from': 1166, 'to': 1175, 'similarity': 0.98, 'video': 'https://media.trace.moe/video/11887/Kokoro%20Connect%20-%2005%20(BD%201280x720%20x264%20AACx2).mp4?t=1170.5&now=1664992800&token=ZWkNmX1xd3xJwKdaiB9Cn8NpGU', 'image': 'https://media.trace.moe/image/11887/Kokoro%20Connect%20-%2005%20(BD%201280x720%20x264%20AACx2).mp4.jpg?t=1170.5&now=1664992800&token=tOtmPrnYOezNspnuPTCgEkAfKAs'}
2022-10-06 01:14:27.739 | INFO | __main__:show_result:36 - {'id': 11887, 'idMal': 11887, 'title': {'native': 'ココロコネクト', 'romaji': 'Kokoro Connect', 'english': 'Kokoro Connect', 'chinese': '心連·情結'}, 'type': 'ANIME', 'format': 'TV', 'startDate': {'year': 2012, 'month': 7, 'day': 8}, 'endDate': {'year': 2012, 'month': 9, 'day': 30}, 'coverImage': {'large': 'https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/bx11887-h8SRoEslkQYX.jpg'}, 'synonyms': ['Kokoroco', '戀愛隨意鏈', '戀愛隨意連結', '心靈鏈環', '心靈接觸', '心與心的連結'], 'isAdult': False}
2022-10-06 01:14:27.740 | INFO | __main__:show_result:37 - 9986249
2022-10-06 01:14:27.740 | INFO | __main__:show_result:38 - 11887
2022-10-06 01:14:27.740 | INFO | __main__:show_result:39 - 11887
2022-10-06 01:14:27.740 | INFO | __main__:show_result:40 - ココロコネクト
2022-10-06 01:14:27.741 | INFO | __main__:show_result:41 - Kokoro Connect
2022-10-06 01:14:27.741 | INFO | __main__:show_result:42 - Kokoro Connect
2022-10-06 01:14:27.741 | INFO | __main__:show_result:43 - 心連·情結
2022-10-06 01:14:27.741 | INFO | __main__:show_result:44 - ['Kokoroco', '戀愛隨意鏈', '戀愛隨意連結', '心靈鏈環', '心靈接觸', '心與心的連結']
2022-10-06 01:14:27.741 | INFO | __main__:show_result:45 - False
2022-10-06 01:14:27.742 | INFO | __main__:show_result:46 - ANIME
2022-10-06 01:14:27.742 | INFO | __main__:show_result:47 - TV
2022-10-06 01:14:27.742 | INFO | __main__:show_result:48 - {'year': 2012, 'month': 7, 'day': 8}
2022-10-06 01:14:27.742 | INFO | __main__:show_result:49 - {'year': 2012, 'month': 9, 'day': 30}
2022-10-06 01:14:27.742 | INFO | __main__:show_result:50 - https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/bx11887-h8SRoEslkQYX.jpg
2022-10-06 01:14:27.743 | INFO | __main__:show_result:51 - Kokoro Connect - 05 (BD 1280x720 x264 AACx2).mp4
2022-10-06 01:14:27.743 | INFO | __main__:show_result:52 - 5
2022-10-06 01:14:27.743 | INFO | __main__:show_result:53 - 1166
2022-10-06 01:14:27.743 | INFO | __main__:show_result:54 - 1175
2022-10-06 01:14:27.743 | INFO | __main__:show_result:55 - 98.0
2022-10-06 01:14:27.744 | INFO | __main__:show_result:56 - https://media.trace.moe/video/11887/Kokoro%20Connect%20-%2005%20(BD%201280x720%20x264%20AACx2).mp4?t=1170.5&now=1664992800&token=ZWkNmX1xd3xJwKdaiB9Cn8NpGU
2022-10-06 01:14:27.752 | INFO | __main__:show_result:57 - https://media.trace.moe/image/11887/Kokoro%20Connect%20-%2005%20(BD%201280x720%20x264%20AACx2).mp4.jpg?t=1170.5&now=1664992800&token=tOtmPrnYOezNspnuPTCgEkAfKAs
在 GitHub 上编辑此页 (opens new window)
上次更新: 2024/07/27, 01:25:05