{"id":23251337,"url":"https://github.com/renfei/googleindexing","last_synced_at":"2026-01-11T17:40:26.684Z","repository":{"id":37135984,"uuid":"246219375","full_name":"renfei/GoogleIndexing","owner":"renfei","description":"借助 Indexing API，任何网站所有者都可在添加或移除网页时直接告知 Google。这样一来，Google 就能及时整理网页并安排新的抓取，从而带来更优质的用户流量。目前，Indexing API 只能用于抓取包含 JobPosting 或 BroadcastEvent（嵌套于 VideoObject）的网页。","archived":false,"fork":false,"pushed_at":"2022-06-17T02:55:37.000Z","size":28,"stargazers_count":5,"open_issues_count":5,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-12-17T09:07:48.534Z","etag":null,"topics":["google","google-indexing","google-indexing-api","indexing","push"],"latest_commit_sha":null,"homepage":"https://www.renfei.net/posts/1003342","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/renfei.png","metadata":{"files":{"readme":"README-CN.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-03-10T05:53:45.000Z","updated_at":"2023-09-18T10:18:05.000Z","dependencies_parsed_at":"2022-08-24T13:00:09.912Z","dependency_job_id":null,"html_url":"https://github.com/renfei/GoogleIndexing","commit_stats":null,"previous_names":["renfei-net/googleindexing"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/renfei%2FGoogleIndexing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/renfei%2FGoogleIndexing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/renfei%2FGoogleIndexing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/renfei%2FGoogleIndexing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/renfei","download_url":"https://codeload.github.com/renfei/GoogleIndexing/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230408135,"owners_count":18220977,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["google","google-indexing","google-indexing-api","indexing","push"],"created_at":"2024-12-19T09:17:54.588Z","updated_at":"2026-01-11T17:40:26.639Z","avatar_url":"https://github.com/renfei.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"简体中文 | [English](./README.md)\n\n# Google Indexing\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://search.maven.org/search?q=g:%22net.renfei%22%20AND%20a:%22googleindexing%22\"\u003e\u003cimg src=\"https://img.shields.io/maven-central/v/net.renfei/googleindexing.svg?label=Maven%20Central\" alt=\"Latest Stable Version\"/\u003e\u003c/a\u003e\n\u003ca href=\"https://travis-ci.org/NeilRen/GoogleIndexing\"\u003e\u003cimg src=\"https://travis-ci.org/NeilRen/GoogleIndexing.svg?branch=master\"/\u003e\u003c/a\u003e\n\u003ca href=\"https://www.codacy.com/app/NeilRen/GoogleIndexing?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=NeilRen/GoogleIndexing\u0026amp;utm_campaign=Badge_Grade\"\u003e\u003cimg src=\"https://api.codacy.com/project/badge/Grade/1372d594a218417a83535ee0fbb8bfb2\"/\u003e\u003c/a\u003e\n\u003ca href=\"https://ci.appveyor.com/project/NeilRen/GoogleIndexing\"\u003e\u003cimg src=\"https://ci.appveyor.com/api/projects/status/cmxr90l89uc68jwv/branch/master?svg=true\"/\u003e\u003c/a\u003e\n\u003c/p\u003e\n借助 Indexing API，任何网站所有者都可在添加或移除网页时直接告知 Google。这样一来，Google 就能及时整理网页并安排新的抓取，从而带来更优质的用户流量。目前，Indexing API 只能用于抓取包含 JobPosting 或 BroadcastEvent（嵌套于 VideoObject）的网页。对于包含很多短效网页（如招聘信息或直播视频）的网站，Indexing API 会通过为不同的内容分别推送更新，使搜索结果中的内容保持最新状态。\n\n## 安装依赖\n如果您使用Apache Maven来管理Java项目，只需在项目的`pom.xml`文件加入相应的依赖项即可。您只需在`pom.xml`中声明以下依赖：\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003enet.renfei\u003c/groupId\u003e\n    \u003cartifactId\u003egoogleindexing\u003c/artifactId\u003e\n    \u003cversion\u003e1.0.1\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n## 开始使用 \n1.启用 Indexing API，创建新服务帐号，在 Search Console 中验证所有权并获取用于验证 API 调用的访问令牌，从而满足前提条件。  \n2.发送请求，通知 Google 有新增、更新或删除的网页。  \n3.您可能需要比默认配额更多的配额。要查看当前配额和请求更多配额，请参阅配额。 \n\n## 详细教程\n更多详细教程请关注：[https://www.renfei.net/posts/1003342](https://www.renfei.net/posts/1003342)\n\n## 案例\n```java\nimport com.alibaba.fastjson.JSON;\nimport com.google.api.services.indexing.v3.model.UrlNotificationMetadata;\nimport net.renfei.googleindexing.GoogleIndexing;\nimport net.renfei.googleindexing.entity.UrlNotification;\nimport net.renfei.googleindexing.entity.UrlNotificationType;\n\npublic class Demo {\n    public static void main(String[] args) {\n        try {\n            GoogleIndexing googleIndexing = new GoogleIndexing(\"/Users/renfei/Google/Ren-Fei-5a8df7c2b912.json\");\n            UrlNotification urlNotification = new UrlNotification();\n            urlNotification.setUrl(\"https://www.renfei.net\");\n            urlNotification.setType(UrlNotificationType.URL_UPDATED);\n            UrlNotificationMetadata urlNotificationMetadata = googleIndexing.publish(urlNotification);\n            System.out.printf(JSON.toJSONString(urlNotificationMetadata));\n        } catch (Exception ex) {\n            ex.printStackTrace();\n        }\n\n    }\n}\n```\n\n## 中国大陆网络\n您需要注意：在中国大陆的网络中无法访问谷歌的API接口，您需要让程序运行在可以访问谷歌的网络环境中。","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frenfei%2Fgoogleindexing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frenfei%2Fgoogleindexing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frenfei%2Fgoogleindexing/lists"}