ภาพรวม
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
Safe Browsing API คืออะไร
API การเรียกดูอย่างปลอดภัยต่อไปนี้มีไว้เพื่อการใช้งานที่ไม่ใช่เชิงพาณิชย์เท่านั้น หากต้องการใช้ API
เพื่อตรวจหา URL ที่เป็นอันตรายเพื่อวัตถุประสงค์เชิงพาณิชย์ ซึ่งหมายถึง "เพื่อวัตถุประสงค์ในการขายหรือสร้างรายได้
" โปรดดู Web Risk API
Safe Browsing API (v4) ช่วยให้แอปพลิเคชันไคลเอ็นต์ตรวจสอบ URL เทียบกับรายการทรัพยากรบนเว็บที่ไม่ปลอดภัยของ Google ซึ่งมีการอัปเดตอยู่เป็นประจำได้
ตัวอย่างของแหล่งข้อมูลบนเว็บที่ไม่ปลอดภัย ได้แก่ เว็บไซต์วิศวกรรมสังคม (ฟิชชิงและเว็บไซต์หลอกลวง) และเว็บไซต์ที่เป็นโฮสต์ให้กับมัลแวร์หรือซอฟต์แวร์ที่ไม่พึงประสงค์
URL ที่พบในรายการ Google Safe Browsing จะถือว่าไม่ปลอดภัย
หากต้องการตรวจสอบว่า URL อยู่ในรายการใดก็ตามของฟีเจอร์การเรียกดูอย่างปลอดภัยหรือไม่ ไคลเอ็นต์สามารถใช้
Lookup API (v4)
หรือ Update API (v4)
Lookup API (v4)
Lookup API ช่วยให้แอปพลิเคชันไคลเอ็นต์ส่ง URL ไปยังเซิร์ฟเวอร์ Google Safe Browsing เพื่อ
ตรวจสอบสถานะของ URL API นี้ใช้งานง่ายและไม่ซับซ้อน เนื่องจากหลีกเลี่ยงความซับซ้อนของ Update API
ข้อดี
- การตรวจสอบ URL อย่างง่าย: คุณส่งคำขอ HTTP
POST
พร้อม URL จริง
และเซิร์ฟเวอร์จะตอบกลับด้วยสถานะของ URL (ปลอดภัยหรือไม่ปลอดภัย)
ข้อเสีย
- ความเป็นส่วนตัว: URL จะไม่ได้รับการแฮช ดังนั้นเซิร์ฟเวอร์จึงทราบว่าคุณค้นหา URL ใด
- เวลาในการตอบสนอง: เซิร์ฟเวอร์จะประมวลผลคำขอการค้นหาทุกรายการ เราไม่
รับประกันเวลาในการตอบกลับการค้นหา
หากคุณไม่กังวลเรื่องความเป็นส่วนตัวของ URL ที่ค้นหามากนัก และยอมรับเวลาในการตอบสนองที่เกิดจากคำขอเครือข่ายได้ ให้ลองใช้ Lookup API เนื่องจากใช้งานได้ง่าย
อัปเดต API (v4)
Update API ช่วยให้แอปพลิเคชันไคลเอ็นต์ดาวน์โหลดรายการ Safe Browsing เวอร์ชันที่เข้ารหัสเพื่อตรวจสอบ URL ในเครื่องฝั่งไคลเอ็นต์ได้ Update API ออกแบบมาสำหรับไคลเอ็นต์ที่ต้องการผลการตัดสินที่มีความถี่สูงและเวลาในการตอบสนองต่ำ เว็บเบราว์เซอร์และแพลตฟอร์มซอฟต์แวร์หลายรายการใช้ API นี้เพื่อปกป้องผู้ใช้จำนวนมาก
ข้อดี
- ความเป็นส่วนตัว: คุณจะแลกเปลี่ยนข้อมูลกับเซิร์ฟเวอร์ไม่บ่อยนัก (เฉพาะหลังจากที่คำนำหน้าแฮชในเครื่อง
ตรงกัน) และใช้ URL ที่แฮช ดังนั้นเซิร์ฟเวอร์จึงไม่ทราบ URL จริงที่ไคลเอ็นต์
ค้นหา
- เวลาในการตอบสนอง: คุณจะดูแลฐานข้อมูลในเครื่องที่มีสำเนารายการของ Google Safe Browsing โดยไม่จำเป็นต้องค้นหาเซิร์ฟเวอร์ทุกครั้งที่ต้องการตรวจสอบ URL
ข้อเสีย
- การติดตั้งใช้งาน: คุณต้องตั้งค่าฐานข้อมูลในเครื่อง จากนั้นดาวน์โหลดและอัปเดตสำเนาในเครื่องของรายการการท่องเว็บอย่างปลอดภัยเป็นระยะๆ (จัดเก็บเป็นแฮช SHA256 แบบความยาวผันแปร)
- การตรวจสอบ URL ที่ซับซ้อน: คุณต้องทราบวิธีทำ URL ให้เป็น Canonical, สร้างนิพจน์คำต่อท้าย/คำนำหน้า
และคำนวณแฮช SHA256 (เพื่อเปรียบเทียบกับสำเนาในเครื่องของรายการการท่องเว็บอย่างปลอดภัย
รวมถึงรายการการท่องเว็บอย่างปลอดภัยที่จัดเก็บไว้ในเซิร์ฟเวอร์)
หากคุณกังวลเกี่ยวกับความเป็นส่วนตัวของ URL ที่ค้นหาหรือเวลาในการตอบสนองที่เกิดจากคำขอเครือข่าย ให้ใช้ Update API
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-25 UTC
[null,null,["อัปเดตล่าสุด 2025-07-25 UTC"],[[["\u003cp\u003eThe Safe Browsing APIs (v4) enable client applications to check URLs against Google's lists of unsafe web resources, including phishing sites and those hosting malware.\u003c/p\u003e\n"],["\u003cp\u003eTwo APIs are available: Lookup API (v4) for simple URL checks and Update API (v4) for local, privacy-focused checks.\u003c/p\u003e\n"],["\u003cp\u003eLookup API (v4) offers ease of use but has privacy and response time limitations.\u003c/p\u003e\n"],["\u003cp\u003eUpdate API (v4) prioritizes privacy and speed but requires more complex implementation and URL handling.\u003c/p\u003e\n"],["\u003cp\u003eThese APIs are for non-commercial use only; commercial users should refer to the Web Risk API.\u003c/p\u003e\n"]]],["Safe Browsing APIs allow client applications to check URLs against Google's unsafe web resource lists, distinguishing between non-commercial and commercial use (Web Risk API). The Lookup API checks URL status via server requests, offering simplicity but compromising privacy and response time. The Update API downloads encrypted lists for local checks, prioritizing privacy and speed but requiring complex implementation, database setup, and hash management. Users can choose between these based on privacy needs and latency tolerance.\n"],null,["# Overview\n\nWhat are the Safe Browsing APIs?\n--------------------------------\n\nThe following Safe Browsing APIs are for non-commercial use only. If you need to use APIs\nto detect malicious URLs for commercial purposes -- meaning \"for sale or revenue-generating\npurposes\" -- please refer to the [Web Risk API](https://cloud.google.com/web-risk).\n\nThe Safe Browsing APIs (v4) let your client applications check URLs against Google's\nconstantly updated lists of unsafe web resources. Examples of unsafe web resources are social\nengineering sites (phishing and deceptive sites) and sites that host malware or unwanted software.\nAny URL found on a Safe Browsing list is considered unsafe.\n\nTo determine if a URL is on any of the Safe Browsing lists, clients can use either\nthe [Lookup API (v4)](/safe-browsing/v4/lookup-api)\nor the [Update API (v4)](/safe-browsing/v4/update-api).\n\nLookup API (v4)\n---------------\n\nThe Lookup API lets your client applications send URLs to the Google Safe Browsing server to\ncheck their status. The API is simple and easy to use, as it avoids the complexities of the\nUpdate API.\n\nAdvantages:\n\n- Simple URL checks: You send an HTTP `POST` request with the actual URLs, and the server responds with the state of the URLs (safe or unsafe).\n\nDrawbacks:\n\n- Privacy: URLs are not hashed, so the server knows which URLs you look up.\n- Response time: Every lookup request is processed by the server. We don't provide guarantees on lookup response time.\n\nIf you are not too concerned about the privacy of the queried URLs, and you can tolerate the\nlatency induced by a network request, consider using the Lookup API since it's fairly easy to\nuse.\n\nUpdate API (v4)\n---------------\n\nThe Update API lets your client applications download encrypted versions of the Safe Browsing\nlists for local, client-side checks of URLs. The Update API is designed for clients that require\nhigh frequency, low-latency verdicts. Several web browsers and software platforms use this\nAPI to protect large sets of users.\n\nAdvantages:\n\n- Privacy: You exchange data with the server infrequently (only after a local hash prefix match) and using hashed URLs, so the server never knows the actual URLs queried by the clients.\n- Response time: You maintain a local database that contains copies of the Safe Browsing lists; they do not need to query the server every time they want to check a URL.\n\nDrawbacks:\n\n- Implementation: You need to set up a local database and then download, and periodically update, the local copies of the Safe Browsing lists (stored as variable-length SHA256 hashes).\n- Complex URL checks: You need to know how to canonicalize URLs, create suffix/prefix expressions, and compute SHA256 hashes (for comparison with the local copies of the Safe Browsing lists as well as the Safe Browsing lists stored on the server).\n\nIf you are concerned about the privacy of the queried URLs or the latency induced by a\nnetwork request, use the Update API."]]