Created
August 8, 2021 01:20
-
-
Save wilt00/1733461db73af97f381f2d1a0b5002d5 to your computer and use it in GitHub Desktop.
FeedWrangler Feed Adder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Usage: blog.sh <url> | |
# | |
# Add a new feed to a FeedWrangler Smart Stream | |
# Url input doesn't need to be a link to an RSS document; FeedWrangler will | |
# figure out if there's a feed available on the page automatically | |
URL='https://feedwrangler.net/api/v2' | |
EMAIL='<EMAIL>' | |
PASSWORD='<PASSWORD>' | |
APIKEY='<APIKEY>' | |
BLOGS='<STREAM ID>' | |
set -euxo pipefail | |
TOKEN=$(curl -s "$URL/users/authorize?email=$EMAIL&password=$PASSWORD&client_key=$APIKEY" \ | |
| jq --raw-output '.access_token') | |
ADDRESP=$(curl -s "$URL/subscriptions/add_feed_and_wait?access_token=$TOKEN&feed_url=$1&choose_first=true") | |
echo "Adding: $(echo "$ADDRESP" | jq '.feed.feed_url')" | |
NEWFEED=$(echo "$ADDRESP" | jq '.feed.feed_id') | |
BLOGFEEDS=$(curl -s "$URL/streams/list?access_token=$TOKEN" \ | |
| jq ".streams[] | select(.stream_id==$BLOGS) | .feeds[].feed_id" \ | |
| tr '\n' ',') | |
curl -s "$URL/streams/update?access_token=$TOKEN&stream_id=$BLOGS&feed_ids=$BLOGFEEDS$NEWFEED" \ | |
| jq '.' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment