Open arthurlutz opened 2 years ago
Okay, here's some random thoughts:
This plugin, by default, will import all toots going forward. I think its default behavior is to ignore boosts and replies, too.
You could, I believe---I'd have to dig into the code a bit---then use it in combination with https://github.com/janboddez/import-mastodon-comments to also import replies as comments. That would give you "threads" in a format that is very "native" to WordPress.
But that'd be limited to your threads, and it would import all of them. (Also, this second plugin doesn't really deal with threads that branch off in all sorts of directions. Like, there's no "threaded" comments. All replies would be imported chronologically and sit under just the main post.)
You could set up this plugin to include replies, too, (and forget about comments) and it'd then import them as separate posts, making it a bit harder to link them together.
But again, there'd be no way to import only the toots you're looking for.
In fact, I think there is a way to import only certain toots/threads: I think you can restrict importing to toots with a certain hashtag, but you'd have to know upfront (can't go back and re-add the tag after the fact!).
If that isn't an option, yes, you could create a new plugin and reuse some of the existing code.
Like, you could create a new plugin that defines a meta box with a single field that accepts a Mastodon (thread) URL.
Your plugin could then---whenever you create a new post and such a URL is present---go fetch that thread, extract its content---either using the API, like this plugin does, or using something like PHP's DOMDocument, actually downloading ("scraping") and parsing the HTML---and insert it into your WP post's content.
Note-to-self: Import Mastodon Comments requires Share on Mastodon, which may not be ideal. Also, it looks for replies to posts with a _share_on_mastodon_url
meta field (and not those with a _import_from_mastodon_url
as set by this plugin. Might be able to rework it in order to support both (Share and Import) plugins.
This wordpress plugin looks awesome. Thanks for sharing it and developing it.
I would have an use case for something a little different, was wondering if it could be done with this plugin or not.
I have a wordpress blog and also post to mastodon. Sometimes, when I do an elaborate thread or a series of toots on a given project, I think "I should archive or do a more elaborate post on my blog". So I'm looking for a tool for that, point to an URL (or a list of URLs), import the content, rework a bit the content then publish.
Any chance that some of the code here could be used for that ? Could this plugin be configurable to the point of addressing the described use case ?