🕊️鸽子日记🕊️ 🕊️鸽子日记🕊️
首页
  • 帮助手册

    • PicImageSearch
  • 推荐

    • pixiv画师推荐
  • 技术大坑

    • Debain中使用pyppeteer走过的坑
    • 在红米AC2100上OpenWrt使用
    • 创建nuget包(C++/WinRT)
  • Minecraft

    • 养老服务器
  • 友情链接
  • 关于
  • 音乐
支持
  • 网站
  • 资源
  • Vue资源
  • 分类
  • 标签
  • 归档

KitUIN

芜湖!正在摸鱼~
首页
  • 帮助手册

    • PicImageSearch
  • 推荐

    • pixiv画师推荐
  • 技术大坑

    • Debain中使用pyppeteer走过的坑
    • 在红米AC2100上OpenWrt使用
    • 创建nuget包(C++/WinRT)
  • Minecraft

    • 养老服务器
  • 友情链接
  • 关于
  • 音乐
支持
  • 网站
  • 资源
  • Vue资源
  • 分类
  • 标签
  • 归档
  • PicImageSearch

    • PicImageSearch

    • SauceNAO

    • TraceMoe

    • Ascii2D

    • Iqdb

    • Google

      • 返回类型结构说明
      • Demo
        • 示例
    • E-Hantai

    • BaiDu

    • 更新日志

Demo

# Demo

# 示例

    import asyncio
    
    from loguru import logger
    
    from PicImageSearch import Google, Network
    from PicImageSearch.model import GoogleResponse
    
    proxies = "http://127.0.0.1:1081"
    # proxies = None
    # url = "https://raw.githubusercontent.com/kitUIN/PicImageSearch/main/demo/images/test03.jpg"
    url = r"images/test03.jpg"  # 搜索本地图片
    
    
    @logger.catch()
    async def test() -> None:
        async with Network(proxies=proxies) as client:
            google = Google(client=client)
            resp = await google.search(url)
            show_result(resp)
            resp2 = await google.goto_page(resp.get_page_url(2), 2)
            show_result(resp2)
    
    
    def show_result(resp: GoogleResponse) -> None:
        # logger.info(resp.origin)  # Original Data
        # Should start from index 2, because from there is matching image
        logger.info(resp.raw[2].origin)
        logger.info(resp.index)
        logger.info(resp.raw[2].thumbnail)
        logger.info(resp.raw[2].title)
        logger.info(resp.raw[2].url)
        logger.info(resp.page)
        logger.info("-" * 50)
    
    
    if __name__ == "__main__":
        loop = asyncio.get_event_loop()
        loop.run_until_complete(test())
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    from loguru import logger
    
    from PicImageSearch.model import GoogleResponse
    from PicImageSearch.sync import Google as GoogleSync
    
    proxies = "http://127.0.0.1:1081"
    # proxies = None
    # url = "https://raw.githubusercontent.com/kitUIN/PicImageSearch/main/demo/images/test03.jpg"
    url = r"images/test03.jpg"  # 搜索本地图片
    
    
    @logger.catch()
    def test_sync() -> None:
        google = GoogleSync(proxies=proxies)
        resp = google.search(url)
        show_result(resp)
        resp2 = google.goto_page(resp.get_page_url(2), 2)
        show_result(resp2)
    
    
    def show_result(resp: GoogleResponse) -> None:
        # logger.info(resp.origin)  # Original Data
        # Should start from index 2, because from there is matching image
        logger.info(resp.raw[2].origin)
        logger.info(resp.index)
        logger.info(resp.raw[2].thumbnail)
        logger.info(resp.raw[2].title)
        logger.info(resp.raw[2].url)
        logger.info(resp.page)
        logger.info("-" * 50)
    
    
    if __name__ == "__main__":
        test_sync()
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    // Make sure to add code blocks to your code group

    前往查看

    🚀异步测试文件Demo

    - name: 前往查看
      desc: 🚀异步测试文件Demo
      link: https://github.com/kitUIN/PicImageSearch/blob/main/demo/demo_google.py
      bgColor: '#DFEEE7'
      textColor: '#2A3344'
    
    1
    2
    3
    4
    5

    注意事项

    不建议使用res.raw[0] res.raw[1],因为其内容可能是空的
    建议从res.raw[2]开始使用

    程序输出,部分过长数据已省略

    2022-03-27 19:54:10.228 | INFO     | __main__:show_result:40 - <div class="g tF2Cxc" style="width:652px" data-hveid="CBUQAA" data-ved="2ahUKEwjdgb7Sneb2AhUMKEQIHeTfCJAQFSgAegQIFRAA"><div class="kWxLod" data-sokoban-container="SOKOBAN_17789656704627873811"><div class="jtfYYd" style="flex-grow:1"><div class="NJo7tc Z26q7c jGGQ5e" data-header-feature="0"><div class="yuRUbf"><a href="https://kumascans.com/the-strongest-dull-princes-secret-battle-for-the-throne-chapter-3/" data-ved="2ahUKEwjdgb7Sneb2AhUMKEQIHeTfCJAQFnoECAsQAQ" ping="/url?sa=t&amp;source=web&amp;rct=j&amp;url=https://kumascans.com/the-strongest-dull-princes-secret-battle-for-the-throne-chapter-3/&amp;ved=2ahUKEwjdgb7Sneb2AhUMKEQIHeTfCJAQFnoECAsQAQ"><br/><h3 class="LC20lb MBeuO DKV0Md">Read The Strongest Dull Prince's Secret Battle for the Throne ...</h3><div class="TbwUpd NJjxre"><cite class="iUh30 qLRx3b tjvcx" role="text">https://kumascans.com<span class="dyjrff qzEoUe" role="text"> › the-strongest-dull-princes-secr...</span></cite></div></a><div class="B6fmyf"><div class="TbwUpd"><cite class="iUh30 qLRx3b tjvcx" role="text">https://kumascans.com<span class="dyjrff qzEoUe" role="text"> › the-strongest-dull-princes-secr...</span></cite></div><div class="eFM0qc"><span><div jscontroller="yGWMub" class="action-menu"><a href="#" class="GHDvEf" aria-label="Result Options" aria-expanded="false" aria-haspopup="true" role="button" jsaction="PZcoEd;keydown:wU6FVd;keypress:uWmNaf" data-ved="2ahUKEwjdgb7Sneb2AhUMKEQIHeTfCJAQ7B16BAgLEAQ"><span class="gTl8xb"/></a><ol class="action-menu-panel wHYlTd zsYMMe" role="menu" tabindex="-1" jsaction="keydown:Xiq7wd;mouseover:pKPowd;mouseout:O9bKS" data-ved="2ahUKEwjdgb7Sneb2AhUMKEQIHeTfCJAQqR96BAgLEAU"><li class="action-menu-item OhScic zsYMMe" role="menuitem"><a class="fl" href="https://webcache.googleusercontent.com/search?q=cache:E5h964SO4fYJ:https://kumascans.com/the-strongest-dull-princes-secret-battle-for-the-throne-chapter-3/+&amp;cd=43&amp;hl=en&amp;ct=clnk&amp;gl=us" ping="/url?sa=t&amp;source=web&amp;rct=j&amp;url=https://webcache.googleusercontent.com/search%3Fq%3Dcache:E5h964SO4fYJ:https://kumascans.com/the-strongest-dull-princes-secret-battle-for-the-throne-chapter-3/%2B%26cd%3D43%26hl%3Den%26ct%3Dclnk%26gl%3Dus&amp;ved=2ahUKEwjdgb7Sneb2AhUMKEQIHeTfCJAQIHoECAsQBg"><span>Cached</span></a></li></ol></div></span></div></div></div></div><div class="NJo7tc Z26q7c uUuwM" data-content-feature="1"><div class="VwiC3b yXK7lf MUxGbd yDYNvb lyLwlc"><span class="MUxGbd wuQ4Ob WZ8Tjf"><span>914 × 1300</span><span aria-hidden="true"> · </span><span>Jul 21, 2021</span> — </span><span>Dont forget to read the other <em>manga</em> updates. A list of <em>manga</em> collections Kuma Translation is in the <em>Manga</em> List menu.</span></div></div></div><div class="jtfYYd" style="flex-shrink:0"><div class="NJo7tc Z26q7c W27f5e" data-content-feature="" style="margin-left:12px"><a href="https://kumascans.com/the-strongest-dull-princes-secret-battle-for-the-throne-chapter-3/" ping="/url?sa=t&amp;source=web&amp;rct=j&amp;url=https://kumascans.com/the-strongest-dull-princes-secret-battle-for-the-throne-chapter-3/&amp;ved=2ahUKEwjdgb7Sneb2AhUMKEQIHeTfCJAQ8g16BAgDEAA"><g-img aria-hidden="true" style="border-radius:8px;height:87px;width:61px;position:relative" class="BA0A6c onqIhd"><img id="dimg_7" src="data:image/gif;base64,R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" data-deferred="1" class="rISBZc zr758c" height="87" width="61" alt=" from kumascans.com"/><div class="fWhgmd"/></g-img></a></div></div></div></div>
    2022-03-27 19:54:10.229 | INFO     | __main__:show_result:41 - 1
    2022-03-27 19:54:10.229 | INFO     | __main__:show_result:42 - 
    2022-03-27 19:54:10.229 | INFO     | __main__:show_result:43 - Read The Strongest Dull Prince's Secret Battle for the Throne ...
    2022-03-27 19:54:10.229 | INFO     | __main__:show_result:44 - https://kumascans.com/the-strongest-dull-princes-secret-battle-for-the-throne-chapter-3/
    2022-03-27 19:54:10.241 | INFO     | __main__:show_result:45 - 5
    2022-03-27 19:54:10.241 | INFO     | __main__:show_result:46 - --------------------------------------------------
    2022-03-27 19:54:11.444 | INFO     | __main__:show_result:40 - <div class="g tF2Cxc" style="width:652px" data-hveid="CBoQAA" data-ved="2ahUKEwic_-rTneb2AhXhKEQIHcdnDGI4ChAVKAB6BAgaEAA"><div class="kWxLod" data-sokoban-container="SOKOBAN_1027439209883235368"><div class="jtfYYd" style="flex-grow:1"><div class="NJo7tc Z26q7c jGGQ5e" data-header-feature="0"><div class="yuRUbf"><a href="https://ja.mangatoro.com/manga/the-strongest-dull-princes-secret-battle-for-the-throne/chapter-3-1/29231" data-ved="2ahUKEwic_-rTneb2AhXhKEQIHcdnDGI4ChAWegQIChAB" ping="/url?sa=t&amp;source=web&amp;rct=j&amp;url=https://ja.mangatoro.com/manga/the-strongest-dull-princes-secret-battle-for-the-throne/chapter-3-1/29231&amp;ved=2ahUKEwic_-rTneb2AhXhKEQIHcdnDGI4ChAWegQIChAB"><br/><h3 class="LC20lb MBeuO DKV0Md">The Strongest Dull Prince's Secret Battle For The Throne chap 3</h3><div class="TbwUpd NJjxre"><cite class="iUh30 qLRx3b tjvcx" role="text">https://ja.mangatoro.com<span class="dyjrff qzEoUe" role="text"> › manga › chapter-3-1</span></cite></div></a><div class="B6fmyf"><div class="TbwUpd"><cite class="iUh30 qLRx3b tjvcx" role="text">https://ja.mangatoro.com<span class="dyjrff qzEoUe" role="text"> › manga › chapter-3-1</span></cite></div><div class="eFM0qc"><span><div jscontroller="yGWMub" class="action-menu"><a href="#" class="GHDvEf" aria-label="Result Options" aria-expanded="false" aria-haspopup="true" role="button" jsaction="PZcoEd;keydown:wU6FVd;keypress:uWmNaf" data-ved="2ahUKEwic_-rTneb2AhXhKEQIHcdnDGI4ChDsHXoECAoQBA"><span class="gTl8xb"/></a><ol class="action-menu-panel wHYlTd zsYMMe" role="menu" tabindex="-1" jsaction="keydown:Xiq7wd;mouseover:pKPowd;mouseout:O9bKS" data-ved="2ahUKEwic_-rTneb2AhXhKEQIHcdnDGI4ChCpH3oECAoQBQ"><li class="action-menu-item OhScic zsYMMe" role="menuitem"><a class="fl" href="https://webcache.googleusercontent.com/search?q=cache:KPRljYQyQg4J:https://ja.mangatoro.com/manga/the-strongest-dull-princes-secret-battle-for-the-throne/chapter-3-1/29231+&amp;cd=13&amp;hl=en&amp;ct=clnk&amp;gl=us" ping="/url?sa=t&amp;source=web&amp;rct=j&amp;url=https://webcache.googleusercontent.com/search%3Fq%3Dcache:KPRljYQyQg4J:https://ja.mangatoro.com/manga/the-strongest-dull-princes-secret-battle-for-the-throne/chapter-3-1/29231%2B%26cd%3D13%26hl%3Den%26ct%3Dclnk%26gl%3Dus&amp;ved=2ahUKEwic_-rTneb2AhXhKEQIHcdnDGI4ChAgegQIChAG"><span>Cached</span></a></li></ol></div></span></div></div></div></div><div class="NJo7tc Z26q7c uUuwM" data-content-feature="1"><div class="VwiC3b yXK7lf MUxGbd yDYNvb lyLwlc"><span class="MUxGbd wuQ4Ob WZ8Tjf"><span>1000 × 1422</span><span aria-hidden="true"> · </span><span>Jun 13, 2021</span> — </span><span>➀❤️ Read <em>manga The Strongest Dull Prince's Secret Battle</em> For The Throne Chapter 3 with high quality images, update fastest at MangaToro.</span></div></div></div><div class="jtfYYd" style="flex-shrink:0"><div class="NJo7tc Z26q7c W27f5e" data-content-feature="" style="margin-left:12px"><a href="https://ja.mangatoro.com/manga/the-strongest-dull-princes-secret-battle-for-the-throne/chapter-3-1/29231" ping="/url?sa=t&amp;source=web&amp;rct=j&amp;url=https://ja.mangatoro.com/manga/the-strongest-dull-princes-secret-battle-for-the-throne/chapter-3-1/29231&amp;ved=2ahUKEwic_-rTneb2AhXhKEQIHcdnDGI4ChDyDXoECAUQAA"><g-img aria-hidden="true" style="border-radius:8px;height:87px;width:61px;position:relative" class="BA0A6c onqIhd"><img id="dimg_6" src="data:image/gif;base64,R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" data-deferred="1" class="rISBZc zr758c" height="87" width="61" alt=" from ja.mangatoro.com"/><div class="fWhgmd"/></g-img></a></div></div></div></div>
    2022-03-27 19:54:11.444 | INFO     | __main__:show_result:41 - 2
    2022-03-27 19:54:11.444 | INFO     | __main__:show_result:42 - 
    2022-03-27 19:54:11.444 | INFO     | __main__:show_result:43 - The Strongest Dull Prince's Secret Battle For The Throne chap 3
    2022-03-27 19:54:11.452 | INFO     | __main__:show_result:44 - https://ja.mangatoro.com/manga/the-strongest-dull-princes-secret-battle-for-the-throne/chapter-3-1/29231
    2022-03-27 19:54:11.452 | INFO     | __main__:show_result:45 - 4
    2022-03-27 19:54:11.452 | INFO     | __main__:show_result:46 - --------------------------------------------------
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    #PicImageSearch#wiki#Google
    上次更新: 2022/03/27, 20:47:51
    返回类型结构说明
    返回类型结构说明

    ← 返回类型结构说明 返回类型结构说明→

    最近更新
    01
    创建nuget包(C++/WinRT)
    05-17
    02
    在红米AC2100上OpenWrt使用
    04-26
    03
    返回类型结构说明
    03-27
    更多文章>
    Theme by Vdoing | Copyright © 2021-2022 Evan Xu | MIT License
    • 跟随系统
    • 浅色模式
    • 深色模式
    • 阅读模式