Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IndexNow #423

Open
cohenaj194 opened this issue May 12, 2024 · 1 comment
Open

IndexNow #423

cohenaj194 opened this issue May 12, 2024 · 1 comment

Comments

@cohenaj194
Copy link
Contributor

cohenaj194 commented May 12, 2024

need to do 100 of these a day

https://www.bing.com/webmasters/url-submission-api#APIs

https://www.bing.com/webmasters/submiturl?siteUrl=https://saddlebagexchange.com

curl -X POST "https://ssl.bing.com/webmaster/api.svc/json/SubmitUrlbatch?apikey=$BINGAPIKEY" \
-H "Content-Type: application/json; charset=utf-8" \
-d '{
  "siteUrl": "https://saddlebagexchange.com/",
  "urlList": [
    "https://saddlebagexchange.com/wow/item-data/25",
    "https://saddlebagexchange.com/wow/item-data/35",
    "https://saddlebagexchange.com/wow/item-data/36",
....
    "https://saddlebagexchange.com/wow/item-data/167",
    "https://saddlebagexchange.com/wow/item-data/168",
    "https://saddlebagexchange.com/wow/item-data/169",
    "https://saddlebagexchange.com/wow/item-data/170",
    "https://saddlebagexchange.com/wow/item-data/171"
  ]
}'
@cohenaj194
Copy link
Contributor Author

automated

#!/bin/bash

# Define the API key and the maximum number of URLs to submit
MIN_ID=171
MAX_URLS=$((MIN_ID + 200))  # Adjust the number of URLs as needed

# Download the sitemap and extract URLs containing 'wow/item-data'
URLS=$(curl -s https://saddlebagexchange.com/sitemap.xml | grep 'https://saddlebagexchange.com/wow/item-data/' | head -n $MAX_URLS | sed 's/<[^>]*>//g')

# Prepare the JSON payload
total_urls=0
JSON_PAYLOAD="{\"siteUrl\": \"https://saddlebagexchange.com/\", \"urlList\": ["
for URL in $URLS; do
    id=${URL##*/}
    if [[ $id -gt $MIN_ID ]]; then
        JSON_PAYLOAD+="\"$URL\","
        total_urls=$((total_urls + 1))
        if [[ $total_urls -eq 100 ]]; then
            break
        fi
    fi
done
# Remove the last comma and close the array and object
JSON_PAYLOAD="${JSON_PAYLOAD%,}]"

echo $JSON_PAYLOAD
# # Make the cURL POST request
# curl -X POST "https://ssl.bing.com/webmaster/api.svc/json/SubmitUrlbatch?apikey=$BINGAPIKEY" \
#      -H "Content-Type: application/json; charset=utf-8" \
#      -d "$JSON_PAYLOAD"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant