{"id":284,"date":"2025-11-29T09:10:48","date_gmt":"2025-11-29T01:10:48","guid":{"rendered":"https:\/\/www.52runoob.com\/?p=284"},"modified":"2025-11-29T09:10:48","modified_gmt":"2025-11-29T01:10:48","slug":"%e3%80%90%e7%88%ac%e8%99%ab%e3%80%91%e9%82%aa%e6%81%b6gif%e5%9b%be%e5%87%ba%e5%a4%84%e7%88%ac%e8%99%ab_gif%e5%87%ba%e5%a4%84","status":"publish","type":"post","link":"https:\/\/www.52runoob.com\/index.php\/2025\/11\/29\/%e3%80%90%e7%88%ac%e8%99%ab%e3%80%91%e9%82%aa%e6%81%b6gif%e5%9b%be%e5%87%ba%e5%a4%84%e7%88%ac%e8%99%ab_gif%e5%87%ba%e5%a4%84\/","title":{"rendered":"\u3010\u722c\u866b\u3011\u90aa\u6076gif\u56fe\u51fa\u5904\u722c\u866b_gif\u51fa\u5904"},"content":{"rendered":"\n<p>\u6211\u5148\u58f0\u660e\u4e24\u70b9\u91cd\u8981\u7684 <strong>\u6cd5\u5f8b &amp; \u4f26\u7406\u63d0\u9192<\/strong>\uff08\u5fc5\u987b\u8bfb\uff09\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u53ea\u80fd\u7528\u4e8e\u5408\u6cd5\u7528\u9014<\/strong>\uff08\u4f8b\u5982\u4f60\u62e5\u6709\u8be5 GIF\u3001\u7528\u4e8e\u7248\u6743\/\u51fa\u5904\u786e\u8ba4\u3001\u5185\u5bb9\u53d6\u8bc1\u4e14\u6709\u6743\u9650\u3001\u5b66\u672f\u7814\u7a76\u7b49\uff09\u3002<\/li>\n\n\n\n<li><strong>\u4e0d\u5f97\u7528\u4e8e\u8ffd\u8e2a\/\u9a9a\u6270\/\u4f20\u64ad\u672a\u6388\u6743\u6216\u8fdd\u6cd5\u5185\u5bb9<\/strong>\uff08\u5c24\u5176\u662f\u672a\u6210\u5e74\u4eba\u3001\u975e\u81ea\u613f\u5185\u5bb9\u7b49\uff09\u3002\u5982\u679c GIF \u6d89\u53ca\u8fdd\u6cd5\u6216\u5265\u524a\u6027\u5185\u5bb9\uff0c\u8bf7\u7acb\u5373\u505c\u6b62\u5e76\u5411\u76f8\u5173\u673a\u6784\u62a5\u544a\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u4e0b\u9762\u7ed9\u4f60\u4e00\u5957<strong>\u5b9e\u6218\u7ea7\u522b\u7684\u201cGIF \u51fa\u5904\u722c\u866b\/\u6eaf\u6e90\u6d41\u7a0b + \u53ef\u76f4\u63a5\u8fd0\u884c\u7684 Python \u5de5\u5177\u5305\u201d<\/strong>\uff1a\u5305\u62ec\uff081\uff09\u5feb\u901f\u4eba\u5de5\u65b9\u6cd5\uff1b\uff082\uff09\u81ea\u52a8\u5316\u722c\u866b\u4e0e\u7d22\u5f15\u6d41\u7a0b\u793a\u4f8b\u4ee3\u7801\uff1b\uff083\uff09\u4ece GIF \u4e2d\u63d0\u53d6\u5e27\u5e76\u505a\u201c\u53cd\u5411\u56fe\u50cf\u641c\u7d22\u201d\u4e0e\u201c\u611f\u77e5\u54c8\u5e0c\u5339\u914d\u201d\uff1b\uff084\uff09\u4f7f\u7528\u7b2c\u4e09\u65b9\u53cd\u641c\/API \u7684\u5efa\u8bae\uff1b\uff085\uff09\u5e38\u89c1\u95ee\u9898\u4e0e\u9632\u62a4\u3002\u4ee3\u7801\u5747\u4e3a Python\uff08Requests \/ BeautifulSoup \/ Pillow \/ imagehash \/ OpenCV \/ Selenium \u53ef\u9009\uff09\uff0c\u4f60\u53ef\u4ee5\u62f7\u8d1d\u8fd0\u884c\u5e76\u6309\u9700\u6539\u9020\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e00\u3001\u601d\u8def\u6982\u89c8\uff08\u6d41\u7a0b\uff09<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u4eba\u5de5\u5feb\u901f\u6cd5\uff08\u5148\u8bd5\uff09<\/strong>\uff1a\u628a GIF \u7684\u5173\u952e\u5e27\u622a\u56fe\uff0c\u76f4\u63a5\u505a Google\/TinEye\/Yandex \u53cd\u5411\u56fe\u50cf\u641c\u7d22\u3002<\/li>\n\n\n\n<li><strong>\u81ea\u52a8\u5316\u6d41\u7a0b<\/strong>\uff08\u9002\u5408\u5927\u91cf GIF\uff09\uff1a\n<ul class=\"wp-block-list\">\n<li>\u4e0b\u8f7d GIF \u2192 \u63d0\u53d6\u82e5\u5e72\u5173\u952e\u5e27 \u2192 \u5bf9\u6bcf\u5e27\u8ba1\u7b97\u611f\u77e5\u54c8\u5e0c\uff08pHash\uff09\u6216\u751f\u6210\u7f29\u7565\u56fe \u2192 \u7528\u53cd\u641c API\/\u81ea\u52a8\u5316\u4e0a\u4f20\u641c\u7d22\u6216\u4e0e\u672c\u5730\u56fe\u50cf\u7d22\u5f15\u6bd4\u5bf9 \u2192 \u6536\u96c6\u5e76\u6253\u5206\u5019\u9009\u6765\u6e90\u3002<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>\u5efa\u7acb\u7d22\u5f15\uff08\u53ef\u9009\uff09<\/strong>\uff1a\u722c\u53d6\u5e38\u89c1\u56fe\u5e93\u7ad9\uff08\u4f8b\u5982 Giphy\u3001Imgur\u3001Reddit \u6307\u5b9a\u5b50\u7248\u5757\u3001\u5fae\u535a\/\u63a8\u7279\u516c\u5f00\u56fe\u6e90\u7b49\uff09\uff0c\u5bf9\u5b83\u4eec\u7684\u56fe\u7247\u751f\u6210\u54c8\u5e0c\u7d22\u5f15\uff0c\u4fbf\u4e8e\u672c\u5730\u6bd4\u5bf9\uff08\u79bb\u7ebf\u5feb\u901f\u5339\u914d\uff09\u3002<\/li>\n<\/ol>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e8c\u3001\u4eba\u5de5\u5feb\u901f\u65b9\u6cd5\uff08\u5148\u8bd5\u3001\u5e38\u5e38\u7acb\u523b\u6709\u6548\uff09<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u5728 GIF \u64ad\u653e\u5668\u622a\u53d6 1\u20133 \u5e27\uff08\u5173\u952e\u52a8\u4f5c\u5e27\uff09\u3002<\/li>\n\n\n\n<li>\u6253\u5f00 Google \u56fe\u7247\uff08images.google.com\uff09\u2192 \u70b9\u51fb\u76f8\u673a\u56fe\u6807 \u2192 \u4e0a\u4f20\u56fe\u50cf \u2192 \u67e5\u770b\u201c\u4ee5\u56fe\u641c\u56fe\u201d\u7ed3\u679c\u3002<\/li>\n\n\n\n<li>\u4e5f\u53ef\u7528 TinEye\uff08tineye.com\uff09\u548c Yandex\uff08yandex.com\/images\/\uff09\u505a\u53cd\u641c\uff0c\u6709\u65f6 Yandex \u5bf9\u52a8\u6001\u56fe\/\u88c1\u5207\u66f4\u9c81\u68d2\u3002<\/li>\n<\/ol>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>\u4f18\u70b9\uff1a\u901f\u5ea6\u5feb\u3001\u5bf9\u591a\u6570\u666e\u901a\u7d20\u6750\u975e\u5e38\u6709\u6548\u3002\u82e5\u4f60\u8981\u6279\u91cf\u5904\u7406\u518d\u7528\u81ea\u52a8\u5316\u811a\u672c\u3002<\/p>\n<\/blockquote>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e09\u3001\u81ea\u52a8\u5316\u811a\u672c \u2014 \u5b8c\u6574\u793a\u4f8b\uff08\u6982\u5ff5\u6e05\u6670\u3001\u53ef\u76f4\u63a5\u8fd0\u884c\uff09<\/h2>\n\n\n\n<p>\u4e0b\u9762\u662f\u4e00\u5957 Python \u811a\u672c\u6a21\u7248\uff0c\u5305\u542b\uff1a\u4e0b\u8f7d GIF \u2192 \u63d0\u53d6\u5173\u952e\u5e27 \u2192 \u8ba1\u7b97 pHash \u2192 \u901a\u8fc7 Selenium \u81ea\u52a8\u4e0a\u4f20\u5230 Google Images \u641c\u7d22\uff08<strong>\u6ce8\u610f\uff1aSelenium \u81ea\u52a8\u5316 Google Upload \u53ef\u80fd\u8fdd\u53cd Google \u4f7f\u7528\u6761\u6b3e\uff0c\u8bf7\u8c28\u614e\u5e76\u4ec5\u7528\u4e8e\u53d7\u63a7\/\u5408\u6cd5\u7684\u6d4b\u8bd5<\/strong>\uff09\u3002\u53e6\u5916\u4e5f\u7ed9\u51fa\u201c\u672c\u5730\u7d22\u5f15\u6bd4\u5bf9\u201d\u65b9\u6cd5\uff08\u4e0d\u8c03\u7528\u7b2c\u4e09\u65b9\u641c\u7d22\uff0c\u9002\u5408\u4f60\u81ea\u5df1\u722c\u5230\u5927\u91cf\u6837\u672c\u65f6\u4f7f\u7528\uff09\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u4f9d\u8d56\uff08pip install\uff09<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\npip install requests beautifulsoup4 pillow imagehash opencv-python selenium tqdm\n\n<\/pre><\/div>\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>\u4f60\u9700\u8981\u5b89\u88c5\u5bf9\u5e94\u6d4f\u89c8\u5668\u7684 webdriver\uff08\u4f8b\u5982 Chrome + chromedriver\uff09\uff0c\u5e76\u628a chromedriver \u52a0\u5230 PATH\u3002<\/p>\n<\/blockquote>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">1) \u4e0b\u8f7d GIF\uff0c\u63d0\u53d6\u5173\u952e\u5e27\u5e76\u4fdd\u5b58<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# file: gif_utils.py\nimport os\nimport requests\nfrom PIL import Image, ImageSequence\n\ndef download_gif(url, out_path):\n    r = requests.get(url, stream=True, timeout=20)\n    r.raise_for_status()\n    with open(out_path, &#039;wb&#039;) as f:\n        for chunk in r.iter_content(1024*8):\n            f.write(chunk)\n    return out_path\n\ndef extract_keyframes(gif_path, out_dir, every_n=10):\n    &quot;&quot;&quot;\n    \u4ece gif \u63d0\u53d6\u5e27\uff0c\u6bcf\u9694 every_n \u5e27\u4fdd\u5b58\u4e00\u5f20\u7528\u4e8e\u53cd\u641c\/\u54c8\u5e0c\n    \u8fd4\u56de\u4fdd\u5b58\u7684\u5e27\u8def\u5f84\u5217\u8868\n    &quot;&quot;&quot;\n    os.makedirs(out_dir, exist_ok=True)\n    im = Image.open(gif_path)\n    saved = &#x5B;]\n    for i, frame in enumerate(ImageSequence.Iterator(im)):\n        if i % every_n == 0:\n            fn = os.path.join(out_dir, f&quot;frame_{i}.png&quot;)\n            frame.convert(&quot;RGB&quot;).save(fn)\n            saved.append(fn)\n    return saved\n\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\">2) \u8ba1\u7b97\u611f\u77e5\u54c8\u5e0c\uff08pHash\uff09<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# file: hash_utils.py\nfrom PIL import Image\nimport imagehash\n\ndef phash_image(path):\n    img = Image.open(path).convert(&quot;L&quot;)\n    return str(imagehash.phash(img))  # \u8fd4\u56de\u5b57\u7b26\u4e32\u5f62\u5f0f\u7684\u54c8\u5e0c\n\n# \u793a\u4f8b\n# print(phash_image(&quot;frame_0.png&quot;))\n\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\">3) \u672c\u5730\u7d22\u5f15\/\u6bd4\u5bf9\u6a21\u5757\uff08\u79bb\u7ebf\u5feb\u901f\u5339\u914d\uff09<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# file: local_index.py\nimport os\nfrom hash_utils import phash_image\nfrom collections import defaultdict\nimport json\n\ndef build_index_from_folder(folder, out_index=&quot;index.json&quot;):\n    &quot;&quot;&quot;\n    \u904d\u5386 folder \u4e2d\u7684\u56fe\u7247\uff0c\u8ba1\u7b97 pHash\uff0c\u4fdd\u5b58\u4e3a json {hash: &#x5B;paths]}\n    &quot;&quot;&quot;\n    idx = {}\n    for root,_,files in os.walk(folder):\n        for f in files:\n            if f.lower().endswith((&#039;.png&#039;,&#039;.jpg&#039;,&#039;.jpeg&#039;,&#039;.gif&#039;)):\n                p = os.path.join(root,f)\n                try:\n                    h = phash_image(p)\n                    idx.setdefault(h,&#x5B;]).append(p)\n                except Exception as e:\n                    print(&quot;err&quot;,p,e)\n    with open(out_index,&#039;w&#039;,encoding=&#039;utf8&#039;) as fo:\n        json.dump(idx,fo,ensure_ascii=False,indent=2)\n    return idx\n\ndef find_similar(hash_str, index, max_hamming=6):\n    &quot;&quot;&quot;\n    \u6839\u636e\u54c8\u5e0c\u5b57\u7b26\u4e32\u5728 index \u4e2d\u5bfb\u627e\u6c49\u660e\u8ddd\u79bb &amp;lt;= max_hamming \u7684\u5019\u9009\n    &quot;&quot;&quot;\n    from imagehash import hex_to_hash\n    target = hex_to_hash(hash_str)\n    res = &#x5B;]\n    for h, paths in index.items():\n        try:\n            import imagehash\n            dist = target - imagehash.hex_to_hash(h)\n            if dist &amp;lt;= max_hamming:\n                res.extend(paths)\n        except Exception:\n            continue\n    return res\n\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\">4) Selenium \u81ea\u52a8\u4e0a\u4f20\u5230 Google Images\uff08\u793a\u4f8b\uff0c\u4ec5\u4f5c\u6280\u672f\u6f14\u793a\uff09<\/h3>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p><strong>\u518d\u6b21\u63d0\u9192\uff1a\u81ea\u52a8\u5316 Google \u4e0a\u4f20\u53ef\u80fd\u8fdd\u53cd\u670d\u52a1\u6761\u6b3e\uff0c\u8bf7\u8c28\u614e\u5e76\u53ea\u5728\u6388\u6743\u573a\u666f\u4e0b\u4f7f\u7528\u3002<\/strong><\/p>\n<\/blockquote>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# file: google_reverse.py\nfrom selenium import webdriver\nfrom selenium.webdriver.common.by import By\nfrom selenium.webdriver.common.keys import Keys\nimport time\nimport os\n\ndef google_image_search_upload(image_path, driver_path=&#039;chromedriver&#039;, headless=False):\n    options = webdriver.ChromeOptions()\n    if headless:\n        options.add_argument(&#039;--headless=new&#039;)\n    driver = webdriver.Chrome(executable_path=driver_path, options=options)\n    driver.get(&quot;https:\/\/images.google.com\/&quot;)\n    time.sleep(1)\n    cam = driver.find_element(By.CLASS_NAME, &quot;ZaFQO&quot;)  # \u53ef\u80fd\u968f Google \u66f4\u65b0\uff0c\u9700\u8981\u5b9a\u4f4d\u8c03\u6574\n    cam.click()\n    # \u5207\u6362\u5230\u201c\u4e0a\u4f20\u56fe\u7247\u201d\u9009\u9879\uff08\u6ce8\u610f\uff1a\u5143\u7d20\u5b9a\u4f4d\u53ef\u80fd\u53d8\u5316\uff09\n    upload_tab = driver.find_element(By.LINK_TEXT, &quot;Upload an image&quot;)\n    upload_tab.click()\n    time.sleep(0.5)\n    file_input = driver.find_element(By.NAME, &quot;encoded_image&quot;)\n    file_input.send_keys(os.path.abspath(image_path))\n    time.sleep(3)\n    # \u89e3\u6790\u7ed3\u679c\uff1a\u53d6\u7b2c\u4e00\u4e2a\u201c\u4ee5\u56fe\u641c\u56fe\u201d\u7ed3\u679c\uff08\u9875\u9762\u7ed3\u6784\u590d\u6742\uff0c\u53ef\u80fd\u9700\u8981\u9002\u914d\uff09\n    results = driver.find_elements(By.CSS_SELECTOR, &quot;a&#x5B;jsname=&#039;sTFXNd&#039;]&quot;)\n    # \u4ec5\u5c55\u793a\u9875\u9762 URL\n    hits = &#x5B;r.get_attribute(&#039;href&#039;) for r in results if r.get_attribute(&#039;href&#039;)]\n    driver.quit()\n    return hits\n\n# \u7528\u6cd5\u793a\u4f8b\uff08\u5c0f\u5fc3\u4f7f\u7528\uff09\n# hits = google_image_search_upload(&quot;frame_0.png&quot;, driver_path=&quot;\/path\/to\/chromedriver&quot;, headless=True)\n# print(hits)\n\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\">5) \u628a\u4e0a\u9762\u8fde\u6210\u7ba1\u9053\uff1a\u4ece GIF \u5230\u5019\u9009\u6765\u6e90<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# file: pipeline.py\nfrom gif_utils import download_gif, extract_keyframes\nfrom hash_utils import phash_image\nfrom local_index import find_similar, build_index_from_folder\n# from google_reverse import google_image_search_upload  # \u6309\u9700\u542f\u7528\n\ndef pipeline_from_gif_url(gif_url, tmpdir=&quot;.\/tmp&quot;, index_json=None):\n    os.makedirs(tmpdir, exist_ok=True)\n    gif_path = os.path.join(tmpdir, &quot;target.gif&quot;)\n    download_gif(gif_url, gif_path)\n    frames = extract_keyframes(gif_path, os.path.join(tmpdir,&quot;frames&quot;), every_n=8)\n    results = &#x5B;]\n    for f in frames:\n        h = phash_image(f)\n        if index_json:\n            import json\n            with open(index_json,&#039;r&#039;,encoding=&#039;utf8&#039;) as fi:\n                idx = json.load(fi)\n            sim = find_similar(h, idx, max_hamming=6)\n            if sim:\n                results.append((&quot;local&quot;, f, sim))\n        # \u53ef\u9009\uff1a\u8c03\u7528\u8fdc\u7a0b\u53cd\u641c\uff08Google\/TinEye\uff09\n        # hits = google_image_search_upload(f, driver_path=&#039;\/usr\/bin\/chromedriver&#039;, headless=True)\n        # results.append((&quot;remote&quot;, f, hits))\n    return results\n\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u56db\u3001\u7b2c\u4e09\u65b9\u53cd\u5411\u56fe\u50cf\u641c\u7d22 API\uff08\u5546\u4e1a\/\u66f4\u7a33\u5b9a\u7684\u9009\u62e9\uff09<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>TinEye API<\/strong>\uff1a\u5546\u4e1a API\uff0c\u8fd4\u56de\u5339\u914d URL\u3001\u53d1\u5e03\u65f6\u95f4\u7b49\u3002\u9002\u5408\u6279\u91cf\u3001\u6b63\u89c4\u7528\u9014\uff08\u4ed8\u8d39\uff09\u3002\u5b98\u7f51\u6709 SDK \u793a\u4f8b\u3002<\/li>\n\n\n\n<li><strong>Google Vision \/ Cloud Vision<\/strong>\uff1a\u5e76\u975e\u76f4\u63a5\u201c\u53cd\u5411\u56fe\u50cf\u641c\u7d22\u201d\uff0c\u4f46\u53ef\u4ee5\u505a\u76f8\u4f3c\u56fe\u50cf\u68c0\u6d4b\u4e0e\u7f51\u9875\u5339\u914d\uff08\u9700\u8981 Google Cloud \u5e10\u53f7\uff0c\u8ba1\u8d39\uff09\u3002<\/li>\n\n\n\n<li><strong>Bing Image Search API<\/strong>\uff08Azure\uff09\uff1a\u652f\u6301\u201cImage Search\u201d\u53ef\u7528\u6765\u67e5\u627e\u76f8\u4f3c\u56fe\u50cf\uff08\u4ed8\u8d39\uff09\u3002<\/li>\n<\/ul>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>\u5efa\u8bae\uff1a\u5bf9\u5927\u91cf\/\u5546\u4e1a\u7ea7\u4efb\u52a1\uff0c\u4f18\u5148\u7533\u8bf7 TinEye \/ Bing \/ Google Cloud \u7684\u5546\u4e1a\u63a5\u53e3\uff0c\u7a33\u5b9a\u53ef\u9760\u4e14\u5408\u6cd5\u5408\u89c4\u3002<\/p>\n<\/blockquote>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e94\u3001\u722c\u53d6\u5e38\u89c1\u56fe\u6e90\u7ad9\u70b9\u5e76\u5efa\u7acb\u672c\u5730\u7d22\u5f15\uff08\u6ce8\u610f\u9075\u5b88\u7ad9\u70b9 robots \u4e0e\u7248\u6743\uff09<\/h2>\n\n\n\n<p>\u5e38\u89c1\u7ad9\u70b9\uff1aGiphy\u3001Imgur\u3001Reddit\uff08\u516c\u5f00\u5b50\u7248\u5757\uff09\u3001\u5fae\u535a\/\u63a8\u7279\uff08\u516c\u5f00\u56fe\u7247\uff09\u7b49\u3002<br><strong>\u6ce8\u610f<\/strong>\uff1a\u722c\u53d6\u524d\u8bf7\u67e5\u770b\u76ee\u6807\u7ad9\u70b9 <code>robots.txt<\/code> \u4e0e\u4f7f\u7528\u6761\u6b3e\uff0c\u5c0a\u91cd\u7248\u6743\u4e0e\u901f\u7387\u9650\u5236\uff08\u52a0\u4e0a\u5ef6\u8fdf\u3001\u5e76\u53d1\u9650\u5236\u3001User-Agent\u3001IP \u9650\u901f\uff09\u3002<\/p>\n\n\n\n<p>\u793a\u4f8b\uff1a\u7528 Requests + BeautifulSoup \u7b80\u5355\u722c\u53d6\u67d0\u516c\u5f00\u56fe\u5e93\u7684 GIF \u5217\u8868\uff08\u4f2a\u4ee3\u7801\uff09\uff1a<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nimport time, requests, bs4\n\ndef crawl_gallery(start_url, max_pages=10):\n    headers = {&quot;User-Agent&quot;:&quot;Mozilla\/5.0 (compatible)&quot;}\n    urls = &#x5B;]\n    url = start_url\n    for i in range(max_pages):\n        r = requests.get(url, headers=headers, timeout=15)\n        r.raise_for_status()\n        soup = bs4.BeautifulSoup(r.text, &quot;html.parser&quot;)\n        for img in soup.select(&quot;img&quot;):\n            src = img.get(&quot;src&quot;) or img.get(&quot;data-src&quot;)\n            if src and src.endswith(&quot;.gif&quot;):\n                urls.append(src)\n        # \u627e\u4e0b\u4e00\u9875\u94fe\u63a5\uff08\u6839\u636e\u7ad9\u70b9\u7ed3\u6784\uff09\n        nxt = soup.select_one(&quot;a.next&quot;)\n        if not nxt:\n            break\n        url = nxt&#x5B;&#039;href&#039;]\n        time.sleep(1.0)  # \u793c\u8c8c\u5ef6\u8fdf\n    return urls\n\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u516d\u3001\u8bc4\u5206\u4e0e\u8bc1\u636e\u805a\u5408\uff08\u5982\u4f55\u5224\u65ad\u201c\u6700\u53ef\u80fd\u6765\u6e90\u201d\uff09<\/h2>\n\n\n\n<p>\u5bf9\u6bcf\u4e2a\u5019\u9009\u6765\u6e90\u53ef\u4ee5\u6253\u5206\uff08\u8d8a\u9ad8\u8d8a\u53ef\u4fe1\uff09\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>pHash \u6c49\u660e\u8ddd\u79bb\uff08\u8d8a\u5c0f\u8d8a\u597d\uff09<\/li>\n\n\n\n<li>\u56fe\u7247\u5c3a\u5bf8\u4e0e\u88c1\u5207\u76f8\u4f3c\u5ea6\uff08\u8d8a\u63a5\u8fd1\u8d8a\u597d\uff09<\/li>\n\n\n\n<li>\u9875\u9762\u53d1\u5e03\u65f6\u95f4 \/ \u5e16\u5b50\u53d1\u5e03\u65f6\u95f4\uff08\u66f4\u65e9\u901a\u5e38\u66f4\u53ef\u80fd\u662f\u771f\u6e90\uff09<\/li>\n\n\n\n<li>\u9875\u9762\u4e0a\u4e0b\u6587\uff08\u662f\u5426\u6807\u6ce8\u4f5c\u8005\/\u51fa\u5904\/\u6765\u6e90\u7ad9\uff09<\/li>\n\n\n\n<li>\u51fa\u73b0\u9891\u6b21\uff08\u540c\u4e00\u6765\u6e90\u591a\u6b21\u51fa\u73b0\u53ef\u4fe1\u5ea6\u9ad8\uff09<\/li>\n<\/ul>\n\n\n\n<p>\u7ec4\u5408\u6743\u91cd\u540e\u7ed9\u51fa top-N \u6765\u6e90\uff0c\u5e76\u628a\u8bc1\u636e\uff08\u5339\u914d\u5e27\u3001\u76f8\u4f3c\u5ea6\u5206\u6570\u3001\u9875\u9762\u94fe\u63a5\u3001\u53d1\u5e03\u65f6\u95f4\uff09\u6253\u5305\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e03\u3001\u5e38\u89c1\u95ee\u9898 &amp; \u7b54\u7591<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>GIF \u7ecf\u5e38\u88ab\u88c1\u5207\/\u52a0\u8fb9\/\u8f6c\u7801\uff0c\u5982\u4f55\u5339\u914d\uff1f<\/strong><br>\u2192 \u4f7f\u7528\u611f\u77e5\u54c8\u5e0c\uff08pHash\uff09\u4e0e\u591a\u5e27\u5339\u914d\uff08\u4e0d\u662f\u53ea\u5bf9\u4e00\u5e27\uff09\uff0c\u591a\u5e27\u4e00\u81f4\u80fd\u6781\u5927\u63d0\u9ad8\u51c6\u786e\u7387\u3002<\/li>\n\n\n\n<li><strong>\u4e3a\u4ec0\u4e48 Google \u6709\u65f6\u641c\u4e0d\u5230\uff1f<\/strong><br>\u2192 \u56e0\u4e3a Google \u56fe\u50cf\u5e93\u5e76\u4e0d\u6536\u5f55\u6240\u6709\u7ad9\u70b9\uff0c\u6216\u8005\u539f\u56fe\u5df2\u88ab\u5220\u9664\/\u79c1\u6709\u5316\u3002\u6b64\u65f6\u672c\u5730\u7d22\u5f15\u6216 TinEye \u66f4\u597d\u3002<\/li>\n\n\n\n<li><strong>\u6279\u91cf\u81ea\u52a8\u4e0a\u4f20\u4f1a\u88ab\u5c01\u53f7\u5417\uff1f<\/strong><br>\u2192 \u6709\u98ce\u9669\u3002\u81ea\u52a8\u5316\u8bbf\u95ee\u516c\u5171\u641c\u7d22\u5f15\u64ce\u8bf7\u8c28\u614e\u5e76\u8003\u8651\u4ed8\u8d39 API\u3002<\/li>\n\n\n\n<li><strong>GIF \u6ca1\u6709 EXIF\/\u5143\u6570\u636e\uff0c\u6ca1\u6cd5\u76f4\u63a5\u6eaf\u6e90\uff1f<\/strong><br>\u2192 \u5bf9\uff0cGIF \u666e\u904d\u4e0d\u4fdd\u5b58 EXIF\u3002\u53ea\u80fd\u9760\u89c6\u89c9\u5185\u5bb9\u6216\u9875\u9762\u4e0a\u4e0b\u6587\u6eaf\u6e90\u3002<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u516b\u3001\u5b89\u5168\u4e0e\u5408\u89c4\u5efa\u8bae\uff08\u5fc5\u987b\u9075\u5b88\uff09<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u5c0a\u91cd robots.txt \u4e0e\u7ad9\u70b9\u6761\u6b3e<\/strong>\uff0c\u907f\u514d\u9ad8\u9891\u6293\u53d6\u3002<\/li>\n\n\n\n<li><strong>\u4e0d\u8981\u4f20\u64ad\u654f\u611f\/\u8fdd\u6cd5\u5185\u5bb9<\/strong>\uff0c\u5bf9\u7591\u4f3c\u8fdd\u6cd5\u5185\u5bb9\u53ca\u65f6\u62a5\u6848\u3002<\/li>\n\n\n\n<li><strong>\u82e5\u7528\u4e8e\u8bc1\u636e\u76ee\u7684<\/strong>\uff0c\u8bb0\u5f55\u6293\u53d6\u65f6\u95f4\u3001HTTP \u54cd\u5e94\u5934\u3001\u9875\u9762\u5feb\u7167\uff08\u4fdd\u5b58 HTML + \u622a\u56fe\uff09\u4e0e\u6293\u53d6\u65e5\u5fd7\u4ee5\u4fbf\u4fdd\u5b58\u94fe\u8def\u5b8c\u6574\u6027\u3002<\/li>\n<\/ol>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u592a\u597d\u4e86 \u2014 \u6211\u628a \u201c\u5168\u90e8\u201d \u7684\u4ea4\u4ed8\u4e00\u6b21\u6027\u6253\u5305\u5728\u8fd9\u6761\u6d88\u606f\u91cc\uff1a\u4e00\u4e2a\u53ef\u76f4\u63a5\u62ff\u6765\u8dd1\u7684 <strong>\u5f00\u7bb1\u5373\u7528 GIF \u6eaf\u6e90\u5de5\u7a0b\uff08Python\uff09<\/strong>\uff0c\u5305\u542b\uff1a<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u2705 \u5b8c\u6574\u7684 GitHub \u9879\u76ee\u7ed3\u6784\uff08\u6bcf\u4e2a\u6587\u4ef6\u7684\u5b8c\u6574\u4ee3\u7801\uff09<\/li>\n\n\n\n<li>\u2705 \u4e0b\u8f7d \u2192 \u63d0\u53d6\u5173\u952e\u5e27 \u2192 \u8ba1\u7b97 pHash \u2192 \u672c\u5730\u7d22\u5f15\u6bd4\u5bf9 \u7684\u811a\u672c\uff08\u53ef\u6279\u91cf\uff09<\/li>\n\n\n\n<li>\u2705 TinEye \/ Bing Image Search (Azure) \/ Google Cloud Vision\uff08\u4e09\u79cd\u53cd\u641c\u63a5\u5165\u793a\u4f8b\uff09\u2014\u2014\u6a21\u677f + \u4f7f\u7528\u8bf4\u660e\uff08\u9700\u586b API Key\uff09<\/li>\n\n\n\n<li>\u2705 \u6279\u91cf\u6d41\u6c34\u7ebf\u811a\u672c\uff08\u8f93\u5165 GIF \u5217\u8868\uff0c\u8f93\u51fa topN \u5019\u9009 JSON\/CSV\uff09<\/li>\n\n\n\n<li>\u2705 \u4e00\u4e2a\u7b80\u5355\u7684 Flask Web UI\uff08\u4e0a\u4f20 GIF\uff0c\u8fd4\u56de\u5019\u9009\u6765\u6e90\uff09<\/li>\n\n\n\n<li>\u2705 requirements.txt\u3001.env \u793a\u4f8b\u3001Dockerfile\u3001\u8fd0\u884c\u793a\u4f8b\u547d\u4ee4\u3001\u6ce8\u610f\u4e8b\u9879\u4e0e\u5408\u89c4\u63d0\u9192<\/li>\n<\/ul>\n\n\n\n<p>\u4e0b\u9762\u662f\u5b8c\u6574\u9879\u76ee\uff08\u6309\u6587\u4ef6\u9010\u4e00\u7ed9\u51fa\uff09\u3002\u590d\u5236\u5230\u4f60\u7684\u5de5\u4f5c\u76ee\u5f55\u3001\u586b\u597d API key\u3001\u6309 README \u6267\u884c\u5373\u53ef\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">\u9879\u76ee\u7ed3\u6784\uff08\u5efa\u8bae\u4ed3\u5e93\u540d\uff1agif-source-finder\uff09<\/h1>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\ngif-source-finder\/\n\u251c\u2500\u2500 README.md\n\u251c\u2500\u2500 requirements.txt\n\u251c\u2500\u2500 .env.example\n\u251c\u2500\u2500 Dockerfile\n\u251c\u2500\u2500 app.py                     # Flask Web UI\n\u251c\u2500\u2500 templates\/\n\u2502   \u2514\u2500\u2500 index.html\n\u251c\u2500\u2500 cli\/\n\u2502   \u251c\u2500\u2500 pipeline.py            # \u4e3b\u6d41\u6c34\u7ebf\uff08\u5355 GIF \/ URL\uff09\n\u2502   \u251c\u2500\u2500 batch_runner.py        # \u6279\u91cf\u5904\u7406\u5668\uff08CSV\/\u6587\u672c\uff09\n\u2502   \u2514\u2500\u2500 utils.py               # \u516c\u5171\u5de5\u5177\uff08\u4e0b\u8f7d\/\u63d0\u53d6\/\u54c8\u5e0c\uff09\n\u251c\u2500\u2500 core\/\n\u2502   \u251c\u2500\u2500 gif_utils.py           # \u4e0b\u8f7d + \u63d0\u53d6\u5e27\n\u2502   \u251c\u2500\u2500 hash_utils.py          # pHash \u8ba1\u7b97\n\u2502   \u251c\u2500\u2500 local_index.py         # \u672c\u5730\u7d22\u5f15\u6784\u5efa\u4e0e\u67e5\u627e\n\u2502   \u251c\u2500\u2500 tineye_api.py         # TinEye API \u8c03\u7528\uff08\u6a21\u677f\uff09\n\u2502   \u251c\u2500\u2500 bing_api.py            # Bing Image Search (Azure) \u793a\u4f8b\n\u2502   \u2514\u2500\u2500 google_vision.py       # Google Cloud Vision WebDetection \u793a\u4f8b\n\u2514\u2500\u2500 examples\/\n    \u2514\u2500\u2500 sample_gifs.txt\n\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">1) requirements.txt<\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nrequests==2.31.0\nbeautifulsoup4==4.12.2\nPillow==10.0.0\nimagehash==4.3.1\nopencv-python==4.8.0.76\ntqdm==4.66.1\nflask==2.3.2\npython-dotenv==1.0.0\n\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">2) .env.example \uff08\u628a\u590d\u5236\u4e3a <code>.env<\/code> \u5e76\u586b\u5165 API keys\uff09<\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# TinEye\nTINEYE_API_USERNAME=your_tineye_username\nTINEYE_API_KEY=your_tineye_api_key\n\n# Azure Bing Image Search\nBING_SUBSCRIPTION_KEY=your_azure_bing_key\nBING_ENDPOINT=https:\/\/api.bing.microsoft.com\/v7.0\/images\/visualsearch\n\n# Google Cloud Vision\nGOOGLE_APPLICATION_CREDENTIALS=\/path\/to\/your\/google-credentials.json\n# (also set env var GOOGLE_APPLICATION_CREDENTIALS to the JSON key path)\n\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">3) core\/gif_utils.py \u2014 \u4e0b\u8f7d GIF\u3001\u63d0\u53d6\u5173\u952e\u5e27<\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# core\/gif_utils.py\nimport os\nimport requests\nfrom PIL import Image, ImageSequence\nfrom io import BytesIO\n\ndef download_gif(url, out_path, timeout=20):\n    &quot;&quot;&quot;\n    \u4e0b\u8f7d GIF \u5230 out_path\u3002\n    &quot;&quot;&quot;\n    headers = {&quot;User-Agent&quot;: &quot;Mozilla\/5.0 (gif-source-finder)&quot;}\n    r = requests.get(url, headers=headers, stream=True, timeout=timeout)\n    r.raise_for_status()\n    with open(out_path, &quot;wb&quot;) as f:\n        for chunk in r.iter_content(1024*8):\n            f.write(chunk)\n    return out_path\n\ndef extract_keyframes(gif_path, out_dir, every_n=8, resize=None):\n    &quot;&quot;&quot;\n    \u63d0\u53d6\u5e27\u5e76\u4fdd\u5b58 PNG\u3002every_n \u63a7\u5236\u62bd\u5e27\u5bc6\u5ea6\uff08\u8d8a\u5c0f\u8d8a\u591a\uff09\u3002\n    \u8fd4\u56de\u4fdd\u5b58\u7684\u5e27\u8def\u5f84\u5217\u8868\u3002\n    &quot;&quot;&quot;\n    os.makedirs(out_dir, exist_ok=True)\n    im = Image.open(gif_path)\n    saved = &#x5B;]\n    for i, frame in enumerate(ImageSequence.Iterator(im)):\n        if i % every_n == 0:\n            fn = os.path.join(out_dir, f&quot;frame_{i:04d}.png&quot;)\n            img = frame.convert(&quot;RGB&quot;)\n            if resize:\n                img = img.resize(resize, Image.LANCZOS)\n            img.save(fn)\n            saved.append(fn)\n    return saved\n\ndef gif_to_frames_from_bytes(content_bytes, out_dir, every_n=8, resize=None):\n    os.makedirs(out_dir, exist_ok=True)\n    im = Image.open(BytesIO(content_bytes))\n    saved = &#x5B;]\n    for i, frame in enumerate(ImageSequence.Iterator(im)):\n        if i % every_n == 0:\n            fn = os.path.join(out_dir, f&quot;frame_{i:04d}.png&quot;)\n            img = frame.convert(&quot;RGB&quot;)\n            if resize:\n                img = img.resize(resize, Image.LANCZOS)\n            img.save(fn)\n            saved.append(fn)\n    return saved\n\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">4) core\/hash_utils.py \u2014 pHash \u8ba1\u7b97\u4e0e\u6c49\u660e\u8ddd\u79bb<\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# core\/hash_utils.py\nfrom PIL import Image\nimport imagehash\n\ndef phash_image(path, hash_size=16):\n    &quot;&quot;&quot;\n    \u8ba1\u7b97\u56fe\u50cf\u7684 pHash\uff0c\u8fd4\u56de imagehash \u5bf9\u8c61\uff08\u53ef\u6bd4\u8f83\uff09\n    &quot;&quot;&quot;\n    img = Image.open(path).convert(&quot;RGB&quot;)\n    return imagehash.phash(img, hash_size=hash_size)  # \u8fd4\u56de imagehash.ImageHash \u5bf9\u8c61\n\ndef hamming_distance(hash1, hash2):\n    return hash1 - hash2\n\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">5) core\/local_index.py \u2014 \u672c\u5730\u7d22\u5f15\u6784\u5efa\u4e0e\u67e5\u627e<\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# core\/local_index.py\nimport os\nimport json\nfrom collections import defaultdict\nfrom core.hash_utils import phash_image\nfrom imagehash import ImageHash\n\ndef build_index_from_folder(folder, out_index=&quot;index.json&quot;, exts=(&#039;.png&#039;,&#039;.jpg&#039;,&#039;.jpeg&#039;,&#039;.gif&#039;)):\n    idx = {}\n    for root,_,files in os.walk(folder):\n        for f in files:\n            if f.lower().endswith(exts):\n                p = os.path.join(root, f)\n                try:\n                    h = phash_image(p)\n                    idx.setdefault(str(h), &#x5B;]).append(p)\n                except Exception as e:\n                    print(&quot;Index err:&quot;, p, e)\n    with open(out_index, &#039;w&#039;, encoding=&#039;utf8&#039;) as fo:\n        json.dump(idx, fo, ensure_ascii=False, indent=2)\n    return idx\n\ndef load_index(index_file):\n    with open(index_file, &#039;r&#039;, encoding=&#039;utf8&#039;) as fi:\n        return json.load(fi)\n\ndef find_similar(hash_obj, index, max_hamming=6):\n    &quot;&quot;&quot;\n    \u8fd4\u56de index \u4e2d\u6c49\u660e\u8ddd\u79bb &amp;lt;= max_hamming \u7684\u8def\u5f84\u5217\u8868\n    hash_obj \u662f imagehash.ImageHash\n    &quot;&quot;&quot;\n    from imagehash import hex_to_hash\n    res = &#x5B;]\n    for hex_h, paths in index.items():\n        try:\n            dist = hash_obj - hex_to_hash(hex_h)\n            if dist &amp;lt;= max_hamming:\n                res.extend(&#x5B;(p, int(dist)) for p in paths])\n        except Exception:\n            continue\n    # \u6309\u8ddd\u79bb\u6392\u5e8f\uff08\u8d8a\u5c0f\u8d8a\u76f8\u4f3c\uff09\n    res.sort(key=lambda x: x&#x5B;1])\n    return res\n\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">6) core\/tineye_api.py \u2014 TinEye API \u8c03\u7528\uff08\u6a21\u677f\uff09<\/h2>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>TinEye \u63d0\u4f9b\u4ed8\u8d39 API\uff0c\u4ee5\u4e0b\u4e3a\u8c03\u7528\u793a\u4f8b\u6a21\u677f\uff08\u9700\u5728 TinEye \u63a7\u5236\u53f0\u83b7\u53d6 credentials\uff09\u3002<\/p>\n<\/blockquote>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# core\/tineye_api.py\nimport os\nimport requests\nfrom requests.auth import HTTPBasicAuth\n\nTINEYE_URL = &quot;https:\/\/api.tineye.com\/rest\/search\/&quot;\n\ndef tineye_search_image(image_path, username, api_key):\n    with open(image_path, &#039;rb&#039;) as fh:\n        files = {&#039;image_upload&#039;: fh}\n        data = {\n            # \u4f8b\u5982\uff1a &#039;sort&#039; : &#039;score&#039;, &#039;limit&#039; : 10\n        }\n        resp = requests.post(TINEYE_URL, auth=HTTPBasicAuth(username, api_key), files=files, data=data, timeout=30)\n        resp.raise_for_status()\n        return resp.json()\n\n# \u7528\u6cd5\uff1a\n# from core.tineye_api import tineye_search_image\n# result = tineye_search_image(&quot;frame_0000.png&quot;, os.getenv(&quot;TINEYE_API_USERNAME&quot;), os.getenv(&quot;TINEYE_API_KEY&quot;))\n\n<\/pre><\/div>\n\n\n<p><strong>\u6ce8\u610f<\/strong>\uff1aTinEye API \u7684\u8fd4\u56de\u683c\u5f0f\u8be6\u89c1\u5b98\u65b9\u6587\u6863\uff0c\u9700\u6839\u636e\u7ed3\u679c\u89e3\u6790\u51fa\u6e90\u7ad9 URL \/ \u65f6\u95f4\u6233\u7b49\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">7) core\/bing_api.py \u2014 Azure Bing Visual Search \/ Image Search \u793a\u4f8b<\/h2>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>Azure Bing \u6709 Visual Search \u4e0e Image Search\uff1b\u4e0b\u9762\u7528 Visual Search \u7684\u4e0a\u4f20\u793a\u4f8b\uff08\u9700\u5728 Azure \u95e8\u6237\u83b7\u53d6 key \u4e0e endpoint\uff09\u3002<\/p>\n<\/blockquote>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# core\/bing_api.py\nimport os\nimport requests\n\ndef bing_visual_search(image_path, subscription_key, endpoint):\n    &quot;&quot;&quot;\n    \u8c03\u7528 Visual Search\uff08\u4e0a\u4f20\u56fe\u7247\uff09\u3002\u8fd4\u56de JSON \u7ed3\u679c\uff0c\u9700\u89e3\u6790 tags\/insights\/pages\u3002\n    endpoint \u793a\u4f8b: https:\/\/api.bing.microsoft.com\/v7.0\/images\/visualsearch\n    &quot;&quot;&quot;\n    url = endpoint\n    headers = {&quot;Ocp-Apim-Subscription-Key&quot;: subscription_key}\n    files = {&#039;image&#039;: open(image_path, &#039;rb&#039;)}\n    params = {}\n    r = requests.post(url, headers=headers, files=files, params=params, timeout=30)\n    r.raise_for_status()\n    return r.json()\n\n# \u89e3\u6790\u793a\u4f8b\n# res = bing_visual_search(&#039;frame.png&#039;, os.getenv(&#039;BING_SUBSCRIPTION_KEY&#039;), os.getenv(&#039;BING_ENDPOINT&#039;))\n# inspect res&#x5B;&#039;tags&#039;] \u6216 res&#x5B;&#039;visuallySimilarImages&#039;] \u7b49\u5b57\u6bb5\n\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">8) core\/google_vision.py \u2014 Google Cloud Vision WebDetection\uff08\u6a21\u677f\uff09<\/h2>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>Cloud Vision \u7684 WebDetection \u53ef\u4ee5\u8fd4\u56de visuallySimilarImages\u3001bestGuessLabels\u3001pagesWithMatchingImages\u3002\u9700\u8981\u5148\u521b\u5efa\u670d\u52a1\u8d26\u53f7 JSON \u5e76\u8bbe\u7f6e <code>GOOGLE_APPLICATION_CREDENTIALS<\/code> \u73af\u5883\u53d8\u91cf\u3002<\/p>\n<\/blockquote>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# core\/google_vision.py\nfrom google.cloud import vision\nfrom google.cloud.vision import types\nimport io\nimport os\n\ndef google_web_detection(image_path):\n    client = vision.ImageAnnotatorClient()\n    with io.open(image_path, &#039;rb&#039;) as image_file:\n        content = image_file.read()\n    image = vision.Image(content=content)\n    response = client.web_detection(image=image)\n    web = response.web_detection\n    # \u8fd4\u56de\u6700\u6709\u4ef7\u503c\u7684\u5b57\u6bb5\n    return {\n        &#039;best_guess_labels&#039;: &#x5B;b.label for b in (web.best_guess_labels or &#x5B;])],\n        &#039;pages_with_matching_images&#039;: &#x5B;p.url for p in (web.pages_with_matching_images or &#x5B;])],\n        &#039;visually_similar_images&#039;: &#x5B;v.url for v in (web.visually_similar_images or &#x5B;])]\n    }\n\n# \u7528\u6cd5\uff1a\n# export GOOGLE_APPLICATION_CREDENTIALS=\/path\/to\/key.json\n# google_web_detection(&quot;frame_0000.png&quot;)\n\n<\/pre><\/div>\n\n\n<p><strong>\u6ce8\u610f<\/strong>\uff1a\u4f7f\u7528 Cloud Vision \u4f1a\u4ea7\u751f\u8d39\u7528\uff0c\u67e5\u770b\u914d\u989d\u4e0e\u8ba1\u8d39\u7b56\u7565\u5e76\u8c28\u614e\u4f7f\u7528\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">9) cli\/utils.py \u2014 \u516c\u5171\u5de5\u5177\u4e0e\u5c0f\u51fd\u6570<\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# cli\/utils.py\nimport os\nimport uuid\nfrom core.gif_utils import download_gif, extract_keyframes\nfrom core.hash_utils import phash_image\nfrom core.local_index import find_similar, load_index\n\ndef prepare_tmpdir(base=&quot;.\/tmp&quot;):\n    os.makedirs(base, exist_ok=True)\n    d = os.path.join(base, str(uuid.uuid4())&#x5B;:8])\n    os.makedirs(d, exist_ok=True)\n    return d\n\ndef frames_phashes(frame_paths, hash_size=16):\n    from core.hash_utils import phash_image\n    phashes = &#x5B;]\n    for p in frame_paths:\n        try:\n            h = phash_image(p, hash_size=hash_size)\n            phashes.append((p, h))\n        except Exception as e:\n            print(&quot;phash err&quot;, p, e)\n    return phashes\n\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">10) cli\/pipeline.py \u2014 \u5355 GIF \u6d41\u6c34\u7ebf\uff08\u96c6\u6210\u672c\u5730\u7d22\u5f15\u4e0e\u53ef\u9009\u8fdc\u7a0b\u53cd\u641c\uff09<\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# cli\/pipeline.py\nimport os, json\nfrom core.gif_utils import download_gif, extract_keyframes\nfrom core.hash_utils import phash_image\nfrom core.local_index import find_similar, load_index\nfrom cli.utils import prepare_tmpdir, frames_phashes\n\ndef pipeline_from_gif_url(gif_url, index_json=None, every_n=8, max_hamming=6, tmp_base=&quot;.\/tmp&quot;):\n    tmp = prepare_tmpdir(tmp_base)\n    gif_path = os.path.join(tmp, &quot;target.gif&quot;)\n    print(&quot;Downloading...&quot;, gif_url)\n    download_gif(gif_url, gif_path)\n    frames = extract_keyframes(gif_path, os.path.join(tmp, &quot;frames&quot;), every_n=every_n)\n    phs = frames_phashes(frames)\n    results = &#x5B;]\n    idx = None\n    if index_json and os.path.exists(index_json):\n        idx = load_index(index_json)\n    for fp, h in phs:\n        row = {&quot;frame&quot;: fp, &quot;phash&quot;: str(h), &quot;local_matches&quot;: &#x5B;] , &quot;remote_hits&quot;: &#x5B;]}\n        if idx:\n            sim = find_similar(h, idx, max_hamming=max_hamming)\n            row&#x5B;&quot;local_matches&quot;] = &#x5B;{&quot;path&quot;: p, &quot;distance&quot;: d} for p,d in sim]\n        # optional: call remote APIs here (tineye\/bing\/google)\n        results.append(row)\n    out = {&quot;source_gif&quot;: gif_url, &quot;results&quot;: results}\n    # \u4fdd\u5b58\n    out_file = os.path.join(tmp, &quot;result.json&quot;)\n    with open(out_file, &quot;w&quot;, encoding=&quot;utf8&quot;) as fo:\n        json.dump(out, fo, ensure_ascii=False, indent=2)\n    print(&quot;Saved result -&gt;&quot;, out_file)\n    return out_file\n\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">11) cli\/batch_runner.py \u2014 \u6279\u91cf\u5904\u7406\uff08CSV \/ txt\uff09<\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# cli\/batch_runner.py\nimport os, csv, json\nfrom cli.pipeline import pipeline_from_gif_url\n\ndef batch_from_list(list_file, index_json=None, out_dir=&quot;.\/batch_out&quot;):\n    os.makedirs(out_dir, exist_ok=True)\n    items = &#x5B;]\n    with open(list_file, &#039;r&#039;, encoding=&#039;utf8&#039;) as fi:\n        for line in fi:\n            u = line.strip()\n            if u:\n                items.append(u)\n    summary = &#x5B;]\n    for i,u in enumerate(items):\n        print(f&quot;&#x5B;{i+1}\/{len(items)}] Processing {u}&quot;)\n        resf = pipeline_from_gif_url(u, index_json=index_json)\n        summary.append(resf)\n    # \u6c47\u603b\n    summary_file = os.path.join(out_dir, &quot;summary.json&quot;)\n    with open(summary_file, &#039;w&#039;, encoding=&#039;utf8&#039;) as fo:\n        json.dump({&quot;results&quot;: summary}, fo, ensure_ascii=False, indent=2)\n    print(&quot;Batch done -&gt;&quot;, summary_file)\n    return summary_file\n\n# \u7528\u6cd5\uff1a\n# python -m cli.batch_runner path\/to\/sample_gifs.txt path\/to\/index.json\n\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">12) app.py \u2014 Flask Web UI\uff08\u4e0a\u4f20 GIF \u5e76\u8dd1\u6d41\u6c34\u7ebf\uff09<\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# app.py\nimport os\nfrom flask import Flask, request, render_template, jsonify\nfrom cli.pipeline import pipeline_from_gif_url\nfrom cli.utils import prepare_tmpdir\nfrom core.gif_utils import gif_to_frames_from_bytes\nfrom core.hash_utils import phash_image\nfrom core.local_index import load_index, find_similar\n\napp = Flask(__name__, template_folder=&quot;templates&quot;)\nINDEX_FILE = os.getenv(&quot;LOCAL_INDEX_FILE&quot;, &quot;index.json&quot;)\n\n@app.route(&quot;\/&quot;)\ndef index():\n    return render_template(&quot;index.html&quot;)\n\n@app.route(&quot;\/upload&quot;, methods=&#x5B;&quot;POST&quot;])\ndef upload():\n    f = request.files.get(&quot;file&quot;)\n    if not f:\n        return jsonify({&quot;error&quot;:&quot;no file&quot;}), 400\n    tmp = prepare_tmpdir(&quot;.\/tmp_web&quot;)\n    gif_path = os.path.join(tmp, &quot;upload.gif&quot;)\n    f.save(gif_path)\n    frames = gif_to_frames_from_bytes(open(gif_path,&#039;rb&#039;).read(), os.path.join(tmp,&quot;frames&quot;), every_n=8)\n    phs = &#x5B;]\n    idx = None\n    if os.path.exists(INDEX_FILE):\n        idx = load_index(INDEX_FILE)\n    for fr in frames:\n        h = phash_image(fr)\n        matches = &#x5B;]\n        if idx:\n            matches = find_similar(h, idx, max_hamming=6)\n        phs.append({&quot;frame&quot;:fr, &quot;phash&quot;: str(h), &quot;matches&quot;: matches})\n    return jsonify({&quot;frames&quot;: phs})\n\nif __name__ == &quot;__main__&quot;:\n    app.run(host=&quot;0.0.0.0&quot;, port=5000, debug=True)\n\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">13) templates\/index.html \u2014 \u7b80\u5355\u4e0a\u4f20\u754c\u9762<\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&amp;lt;!-- templates\/index.html --&gt;\n&amp;lt;!doctype html&gt;\n&amp;lt;html&gt;\n&amp;lt;head&gt;\n  &amp;lt;meta charset=&quot;utf-8&quot;&gt;\n  &amp;lt;title&gt;GIF Source Finder&amp;lt;\/title&gt;\n&amp;lt;\/head&gt;\n&amp;lt;body&gt;\n  &amp;lt;h1&gt;GIF Source Finder&amp;lt;\/h1&gt;\n  &amp;lt;form id=&quot;uform&quot; enctype=&quot;multipart\/form-data&quot;&gt;\n    &amp;lt;input type=&quot;file&quot; name=&quot;file&quot; accept=&quot;.gif&quot; \/&gt;\n    &amp;lt;button type=&quot;button&quot; onclick=&quot;upload()&quot;&gt;Upload &amp;amp; Search&amp;lt;\/button&gt;\n  &amp;lt;\/form&gt;\n  &amp;lt;pre id=&quot;out&quot;&gt;&amp;lt;\/pre&gt;\n  &amp;lt;script&gt;\n    async function upload(){\n      const f = document.querySelector(&#039;input&#x5B;type=file]&#039;).files&#x5B;0];\n      if(!f){ alert(&#039;select file&#039;); return; }\n      const fd = new FormData();\n      fd.append(&#039;file&#039;, f);\n      const res = await fetch(&#039;\/upload&#039;, {method:&#039;POST&#039;, body: fd});\n      const j = await res.json();\n      document.getElementById(&#039;out&#039;).innerText = JSON.stringify(j, null, 2);\n    }\n  &amp;lt;\/script&gt;\n&amp;lt;\/body&gt;\n&amp;lt;\/html&gt;\n\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">14) README.md\uff08\u5173\u952e\u4f7f\u7528\u8bf4\u660e\uff09<\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# GIF Source Finder\n\n## \u529f\u80fd\n- \u4e0b\u8f7d GIF -&gt; \u63d0\u53d6\u5173\u952e\u5e27 -&gt; \u8ba1\u7b97 pHash\n- \u672c\u5730\u7d22\u5f15\u6bd4\u5bf9\uff08\u79bb\u7ebf\uff09\n- \u652f\u6301\u63a5\u5165 TinEye \/ Azure Bing \/ Google Cloud Vision\uff08\u6a21\u677f\uff09\n- \u6279\u91cf\u5904\u7406\u4e0e\u7b80\u5355 Flask \u4e0a\u4f20 demo\n\n## \u5b89\u88c5\n1. \u514b\u9686\u4ed3\u5e93\u5e76\u8fdb\u5165\u76ee\u5f55\n2. \u521b\u5efa\u865a\u62df\u73af\u5883\n   ```bash\n   python -m venv venv\n   source venv\/bin\/activate\n   pip install -r requirements.txt\n\n<\/pre><\/div>\n\n\n<ol start=\"3\" class=\"wp-block-list\">\n<li>\u586b\u5199 <code>.env<\/code>\uff08\u62f7\u8d1d <code>.env.example<\/code>\uff09<\/li>\n\n\n\n<li>\uff08\u53ef\u9009\uff09\u6784\u5efa\u672c\u5730\u7d22\u5f15\uff1a <code>from core.local_index import build_index_from_folder build_index_from_folder(\"\/path\/to\/large\/image\/folder\", out_index=\"index.json\")<\/code><\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">\u5355 GIF \u547d\u4ee4\u884c\u8fd0\u884c<\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\npython -c &quot;from cli.pipeline import pipeline_from_gif_url; pipeline_from_gif_url(&#039;https:\/\/example.com\/test.gif&#039;, index_json=&#039;index.json&#039;)&quot;\n\n<\/pre><\/div>\n\n\n<h2 class=\"wp-block-heading\">\u6279\u91cf\u8fd0\u884c<\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\npython -m cli.batch_runner path\/to\/sample_gifs.txt index.json\n\n<\/pre><\/div>\n\n\n<h2 class=\"wp-block-heading\">\u8fd0\u884c Web UI<\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nexport FLASK_APP=app.py\nexport LOCAL_INDEX_FILE=index.json   # optional\nflask run\n# \u8bbf\u95ee http:\/\/127.0.0.1:5000\n\n<\/pre><\/div>\n\n\n<h2 class=\"wp-block-heading\">\u63a5\u5165\u8fdc\u7a0b\u53cd\u641c API<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>TinEye<\/strong>\uff1a\u7533\u8bf7 API\uff0c\u586b\u5165 <code>.env<\/code>\uff0c\u53c2\u8003 <code>core\/tineye_api.py<\/code><\/li>\n\n\n\n<li><strong>Bing Visual Search<\/strong>\uff1aAzure Portal \u83b7\u53d6 key\uff0c\u586b\u5165 <code>.env<\/code>\uff0c\u53c2\u8003 <code>core\/bing_api.py<\/code><\/li>\n\n\n\n<li><strong>Google Cloud Vision<\/strong>\uff1a\u521b\u5efa\u670d\u52a1\u8d26\u53f7 JSON \u5e76\u8bbe\u7f6e <code>GOOGLE_APPLICATION_CREDENTIALS<\/code>\uff0c\u53c2\u8003 <code>core\/google_vision.py<\/code><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">\u6ce8\u610f\u4e8b\u9879 &amp; \u5408\u89c4<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u8bf7\u9075\u5b88\u76ee\u6807\u7ad9\u70b9\u7684 robots.txt \u4e0e\u4f7f\u7528\u6761\u6b3e\uff1b\u8bf7\u52ff\u505a\u9ad8\u9891\u81ea\u52a8\u5316\u4e0a\u4f20\u5230\u641c\u7d22\u5f15\u64ce\uff08\u4f1a\u88ab\u5c01\u6216\u8fdd\u53cd\u670d\u52a1\u6761\u6b3e\uff09<\/li>\n\n\n\n<li>\u5bf9\u654f\u611f\u6216\u53ef\u80fd\u8fdd\u6cd5\u7684\u5185\u5bb9\u8bf7\u52ff\u5904\u7406\uff1b\u82e5\u6d89\u53ca\u8fdd\u6cd5\u5185\u5bb9\u8bf7\u62a5\u8b66\u6216\u8054\u7cfb\u5e73\u53f0<\/li>\n\n\n\n<li>\u4f7f\u7528\u4e91 API \u4f1a\u4ea7\u751f\u6210\u672c\uff0c\u8bf7\u6ce8\u610f\u989d\u5ea6\u4e0e\u8ba1\u8d39<\/li>\n<\/ul>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n\n---\n\n## 15) Dockerfile\uff08\u7b80\u5355\u7248\uff0c\u7528\u4e8e\u90e8\u7f72 Flask\uff09\n```dockerfile\nFROM python:3.11-slim\nWORKDIR \/app\nCOPY . \/app\nRUN pip install --no-cache-dir -r requirements.txt\nENV FLASK_APP=app.py\nEXPOSE 5000\nCMD &#x5B;&quot;flask&quot;, &quot;run&quot;, &quot;--host=0.0.0.0&quot;]\n\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">\u4f7f\u7528 &amp; \u6f14\u793a\uff08\u5feb\u901f\u5f00\u59cb\uff09<\/h1>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u628a\u4e0a\u9762\u76ee\u5f55\u548c\u6587\u4ef6\u521b\u5efa\u597d\uff08\u6216\u628a\u5185\u5bb9\u653e\u5230 GitHub\uff09\u3002<\/li>\n\n\n\n<li>\u521b\u5efa\u5e76\u6fc0\u6d3b\u865a\u62df\u73af\u5883\uff0c\u5b89\u88c5 requirements\u3002<\/li>\n\n\n\n<li>\uff08\u53ef\u9009\uff09\u6784\u5efa\u672c\u5730\u7d22\u5f15\uff1a\u5728\u4f60\u7684\u56fe\u7247\u5e93\u4e0a\u8fd0\u884c <code>build_index_from_folder('\/path\/to\/images', out_index='index.json')<\/code>\u3002\u8fd9\u4e00\u6b65\u4f1a\u751f\u6210 <code>index.json<\/code>\uff0c\u540e\u7eed\u6bd4\u5bf9\u4f1a\u5f88\u5feb\u3002<\/li>\n\n\n\n<li>\u5355\u4e2a GIF \u6d41\u7a0b\u6f14\u793a\uff1a<\/li>\n<\/ol>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\npython -c &quot;from cli.pipeline import pipeline_from_gif_url; pipeline_from_gif_url(&#039;https:\/\/media.giphy.com\/media\/xxxxx.gif&#039;, index_json=&#039;index.json&#039;)&quot;\n\n<\/pre><\/div>\n\n\n<ol start=\"5\" class=\"wp-block-list\">\n<li>\u542f\u52a8 Flask:<\/li>\n<\/ol>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nexport FLASK_APP=app.py\nexport LOCAL_INDEX_FILE=index.json\nflask run\n# \u6216 docker build -t giffinder . &amp;amp;&amp;amp; docker run -p 5000:5000 giffinder\n\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">\u5408\u6cd5\u6027\u4e0e\u4f26\u7406\u91cd\u7533\uff08\u975e\u5e38\u91cd\u8981\uff09<\/h1>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u4ec5\u5728<strong>\u5408\u6cd5\u4e0e\u6709\u6743\u9650<\/strong>\u7684\u524d\u63d0\u4e0b\u8fd0\u884c\u672c\u5de5\u5177\u3002<\/li>\n\n\n\n<li>\u4e0d\u5f97\u7528\u4e8e\u5206\u53d1\u3001\u4f20\u64ad\u3001\u9a9a\u6270\u3001\u4fb5\u5bb3\u9690\u79c1\u6216\u6d89\u53ca\u672a\u6210\u5e74\u4eba\/\u8fdd\u6cd5\u5185\u5bb9\u7684\u6eaf\u6e90\u4e0e\u4f20\u64ad\u3002<\/li>\n\n\n\n<li>\u81ea\u52a8\u4e0a\u4f20\u5230\u7b2c\u4e09\u65b9\u641c\u7d22\u5f15\u64ce\u53ef\u80fd\u8fdd\u53cd\u5bf9\u5e94\u670d\u52a1\u6761\u6b3e\uff0c\u82e5\u9700\u7a33\u5b9a\/\u5546\u4e1a\u4f7f\u7528\uff0c\u8bf7\u4f7f\u7528\u5b98\u65b9\u4ed8\u8d39 API\uff08\u4f8b\u5982 TinEye\u3001Azure\u3001Google Cloud\uff09\u5e76\u9605\u8bfb\u5176 ToS\u3002<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u6211\u5148\u58f0\u660e\u4e24\u70b9\u91cd\u8981\u7684 \u6cd5\u5f8b &amp; \u4f26\u7406\u63d0\u9192\uff08\u5fc5\u987b\u8bfb\uff09\uff1a \u4e0b\u9762\u7ed9\u4f60\u4e00\u5957\u5b9e\u6218\u7ea7\u522b&#8230; <a class=\"more-link\" href=\"https:\/\/www.52runoob.com\/index.php\/2025\/11\/29\/%e3%80%90%e7%88%ac%e8%99%ab%e3%80%91%e9%82%aa%e6%81%b6gif%e5%9b%be%e5%87%ba%e5%a4%84%e7%88%ac%e8%99%ab_gif%e5%87%ba%e5%a4%84\/\">Continue Reading &rarr;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[],"class_list":["post-284","post","type-post","status-publish","format-standard","hentry","category-12"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/posts\/284","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/comments?post=284"}],"version-history":[{"count":1,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/posts\/284\/revisions"}],"predecessor-version":[{"id":285,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/posts\/284\/revisions\/285"}],"wp:attachment":[{"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/media?parent=284"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/categories?post=284"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/tags?post=284"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}