Open cohenaj194 opened 4 months ago
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"
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