Google 的 robots.txt 剖析器現在屬於開放原始碼
2019 年 7 月 1 日,星期一
25 年來,《漫遊器排除通訊協定 (REP)》只是個實際存在但非正式的標準。這種情況有時會造成困擾。對網站管理員來說,這意味著某些特殊情況的不確定性,例如他們的文字編輯器將 BOM 字元加進 robots.txt 檔案中。另一方面,對於檢索器和工具開發人員來說,這種情況也帶來了不確定性。例如,他們該如何處理大小為數百 MB 的 robots.txt 檔案?
今天,我們宣布要率先投入,將 REP 確立為網際網路標準。雖然這是一項重要步驟,但對於要剖析 robots.txt 檔案的開發人員來說,是額外的作業負擔。
我們很樂意提供協助:我們將生產系統用於 robots.txt 檔案中的剖析和比對規則的 C++ 程式庫設為開放原始碼。這個程式庫約有 20 年歷史,其中含有許多 90 年代撰寫的程式碼。後來,程式庫不斷演進。我們深入瞭解了網站管理員如何撰寫 robots.txt 檔案和必須納入考慮的特殊案例,並且在合理的情況下,在網際網路草稿中加入我們在這幾年間瞭解的情況。
此外,我們也在開放原始碼套件中納入測試工具,協助您測試幾項規則。建構完成後,使用方法非常簡單:
robots_main <robots.txt content> <user_agent> <url>
如要查看程式庫,請前往我們的 GitHub 存放區尋找 robots.txt 剖析器。我們期待您能使用這項剖析器打造精彩的網站!如果您使用程式庫打造出一些內容,歡迎在 Twitter 上留言給我們,如果您對程式庫有任何意見或疑問,請造訪 GitHub。
發文者:Google 搜尋開放原始碼團隊的 Edu Pereda、Lode Vandevenne 和 Gary Illyes
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
[null,null,[],[[["The Robots Exclusion Protocol (REP), used for controlling web crawler access, is becoming an internet standard after 25 years as a de-facto standard."],["Google open-sourced their C++ robots.txt parsing library to aid developers in implementing the standardized REP."],["The open-sourced library incorporates 20 years of Google's experience and knowledge in handling robots.txt files and edge cases."],["A testing tool is included within the open-source package to facilitate easy verification of robots.txt rules."],["Developers are encouraged to utilize the library and share their creations or feedback with Google."]]],["Google is leading efforts to formalize the Robots Exclusion Protocol (REP) as an internet standard, previously only a de-facto standard. They have open-sourced their C++ library, used for 20 years to parse and match rules in robots.txt files, to assist developers. This library now includes a testing tool, `robots_main`, for checking rules. Developers can engage with Google via GitHub and Twitter. The aim is to address past uncertainties.\n"]]