GoogleIndexing

Google Indexing API Implementation Powered By RENFEI.NET

License

License

Categories

Categories

Net Dex General Purpose Libraries Utility
GroupId

GroupId

net.renfei
ArtifactId

ArtifactId

googleindexing
Last Version

Last Version

1.0.1
Release Date

Release Date

Type

Type

jar
Description

Description

GoogleIndexing
Google Indexing API Implementation Powered By RENFEI.NET
Project URL

Project URL

http://www.renfei.net
Source Code Management

Source Code Management

https://github.com/renfei-net/GoogleIndexing

Download googleindexing

How to add to project

<!-- https://jarcasting.com/artifacts/net.renfei/googleindexing/ -->
<dependency>
    <groupId>net.renfei</groupId>
    <artifactId>googleindexing</artifactId>
    <version>1.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/net.renfei/googleindexing/
implementation 'net.renfei:googleindexing:1.0.1'
// https://jarcasting.com/artifacts/net.renfei/googleindexing/
implementation ("net.renfei:googleindexing:1.0.1")
'net.renfei:googleindexing:jar:1.0.1'
<dependency org="net.renfei" name="googleindexing" rev="1.0.1">
  <artifact name="googleindexing" type="jar" />
</dependency>
@Grapes(
@Grab(group='net.renfei', module='googleindexing', version='1.0.1')
)
libraryDependencies += "net.renfei" % "googleindexing" % "1.0.1"
[net.renfei/googleindexing "1.0.1"]

Dependencies

compile (3)

Group / Artifact Type Version
junit : junit jar 4.12
com.google.apis : google-api-services-indexing jar v3-rev71-1.25.0
com.alibaba : fastjson jar 1.2.62

Project Modules

There are no modules declared in this project.

English | 简体中文

Google Indexing

Latest Stable Version

The Indexing API allows any site owner to directly notify Google when pages are added or removed. This allows Google to schedule pages for a fresh crawl, which can lead to higher quality user traffic. Currently, the Indexing API can only be used to crawl pages with either JobPosting or BroadcastEvent embedded in a VideoObject. For websites with many short-lived pages like job postings or livestream videos, the Indexing API keeps content fresh in search results because it allows updates to be pushed individually.

Installation

If you use Apache Maven to manage Java projects, you only need to add corresponding dependencies to the pom.xml files of the projects. You only need to declare the following dependencies in the pom.xml file

<dependency>
    <groupId>net.renfei</groupId>
    <artifactId>googleindexing</artifactId>
    <version>1.0.1</version>
</dependency>

Get started

  1. Complete the prerequisites by enabling the Indexing API, creating a new service account, verifying ownership in Search Console, and getting an access token to authenticate your API call.
  2. Send requests to notify Google of new, updated, or deleted web pages.
  3. You may need more quota than the default. To view your current quota and request more quota, see Quota.
  4. Please refer to: https://developers.google.com/search/apis/indexing-api/v3/prereqs

Demo

import com.alibaba.fastjson.JSON;
import com.google.api.services.indexing.v3.model.UrlNotificationMetadata;
import net.renfei.googleindexing.GoogleIndexing;
import net.renfei.googleindexing.entity.UrlNotification;
import net.renfei.googleindexing.entity.UrlNotificationType;

public class Demo {
    public static void main(String[] args) {
        try {
            GoogleIndexing googleIndexing = new GoogleIndexing("/Users/renfei/Google/Ren-Fei-5a8df7c2b912.json");
            UrlNotification urlNotification = new UrlNotification();
            urlNotification.setUrl("https://www.renfei.net");
            urlNotification.setType(UrlNotificationType.URL_UPDATED);
            UrlNotificationMetadata urlNotificationMetadata = googleIndexing.publish(urlNotification);
            System.out.printf(JSON.toJSONString(urlNotificationMetadata));
        } catch (Exception ex) {
            ex.printStackTrace();
        }

    }
}
net.renfei

RENFEI.NET

向各位前辈学习的同时,将自己的小工具分享出来。

Versions

Version
1.0.1
1.0.0