A tiny Deno server that:
- Accepts XML-RPC
weblogUpdates.extendedPing
s, - Parses the RSS/JSON feed, then
- Saves blogs, posts, and tags to a database
-
brew install mongodb-community@7.0
-
brew services start mongodb-community@7.0
-
brew install deno
-
Run server:
deno task dev
Using Postman, you can send a POST request to
localhost:1417
with the following raw XML in the body:
<?xml version="1.0"?>
<methodCall>
<methodName>weblogUpdates.extendedPing</methodName>
<params>
<param>
<value>
<string>Example Blog</string>
</value>
</param>
<param>
<value>
<string>https://blog.example.com/</string>
</value>
</param>
<param>
<value>
<string>https://blog.example.com/feed/</string>
</value>
</param>
</params>
</methodCall>
The Deno task should log the values to the console, and add an entry to the
blogs
database collection, if the URL is not a duplicate.
If a feed URL is provided, it will grab the feed XML/JSON and add all the
entries to a database collection called blogPosts
.
If these posts have categories or tags, those will be saved to a tags
collection as well.
You can also try this with real-world data from a local WordPress install (I
recommend wp-now) by adding
localhost:1417
to the list of Update Services in
wp-admin/options-writing.php
.
- Open mongo Shell (
mongosh
) - List databases:
show databases
- Switch to the Pingsville database:
use pingsville
- Show collections:
show collections
- Show documents in blogs collection:
db.blogs.find()
- Clear all blogs from the collection:
db.blogs.deleteMany({})
- Count the number of blogs:
db.blogs.countDocuments({})
- Show documents in blogPosts collection:
db.blogPosts.find()
- Clear all blogs from the collection:
db.blogPosts.deleteMany({})
- Count the number of blogs:
db.blogPosts.countDocuments({})
- Find all blog posts in reverse chronological order:
db.blogPosts.find().sort({ pubDate: -1 })
- Find all blog posts with a particular tag:
db.blogPosts.find({tags: ObjectId("XXXXXXXXXXXXXXXXXXXXXXXX")})
- Find all blog posts from a particular blog:
db.blogPosts.find({"blog.id": ObjectId("XXXXXXXXXXXXXXXXXXXXXXXX")})
- Show documents in tags collection:
db.tags.find()
- Clear all tags from the collection:
db.tags.deleteMany({})
- Count the number of tags:
db.tags.countDocuments({})
- Remove all instances of tag from all blog posts:
db.blogPosts.updateMany({}, { $pull: { "tags": { id: ObjectId("XXXXXXXXXXXXXXXXXXXXXXXX") }}})
- Normalize URLs (remove trailing slash, expand short URLs, etc.)
- Look into using @foxglove/xmlrpc
- Better error handling
- Use GraphQL, to be database-agnostic
- Prevent spamming?
- A job queue?
- Create Pingsville API, for querying data
- Create Pingsville Web, for browsing content
- Scrape feed data and store blog posts
- Store tags
- Normalize tags
- Return something meaningful to the pinger (spec)
- XML-RPC Spec
- Rebooting XML-RPC
- XML-RPC Debugger
- davexmlrpc
- WordPress Update Services
- What happened to Technorati?
Please help me! I don't know what I'm doing!!
You can reach me on Mastodon at @jsit@social.coop
Boy, I haven't really thought about this.