Repository navigation
Learn from X (Twitter) posts alongside Misskey notes - #5
Merged
Merged
Conversation
Add X as a second learning source, fetched through the FxTwitter API with the fxtwitter package, so no X account or token is needed. - Fetch posts with a `from:<user>` search instead of the profile timeline: the timeline only reaches back about 120 posts, while the search excludes reposts and reaches back through the whole history. Backfill up to learnNotesLimit, then poll every twitter.pollIntervalMinutes for posts after the stored since_id cursor, since X has no streaming API. The initial backfill runs in the background after the WebSocket connects, and a failure for one user is logged without stopping the bot. - Split the target users into MISSKEY_TARGET_USERS and TWITTER_TARGET_USERS (at least one is required), both comma separated. An optional `:yyyy/mm/dd` suffix per user restricts learning to posts from that JST date onward. - Keep excludeWords as the common setting and add misskey.excludeWords / twitter.excludeWords, which apply on top of it. Move learnVisibilities under misskey, and make the file config schema strict so stale keys fail loudly. - Identify API calls with a per-install UUIDv7 User-Agent instead of the repository URL, so forks do not present themselves as this repository. - Store tweets with a `twitter:` id prefix so they cannot collide with Misskey note ids, and move the learn-config fingerprint into its own module now that it covers both sources.
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds X (Twitter) as a second learning source, fetched through the FxTwitter API with the
fxtwitterpackage. No X account or token is required; protected accounts cannot be fetched.from:<user>search rather than the profile timeline. The timeline only reaches back about 120 posts per user, while the search excludes reposts and reaches back through the whole history (verified back to 2022 with 1,200+ posts). Reposts are also filtered out in code.learnNotesLimit, new posts are polled everytwitter.pollIntervalMinutes(default 30) using asince_id:cursor, since X has no streaming API. The initial backfill runs in the background after the WebSocket connects, and a failure for one user is logged without stopping the bot.MISSKEY_TARGET_USERSandTWITTER_TARGET_USERS(at least one is required), both comma separated. An optional:yyyy/mm/ddsuffix per user restricts learning to posts from 00:00 JST of that date onward (since_time:on X, acreatedAtfilter and early stop on Misskey).excludeWordsstays as the common setting;misskey.excludeWordsandtwitter.excludeWordsapply on top of it per platform.mimicskey (+<UUIDv7>), generated once per install and stored in the DB, instead of the repository URL, so forks do not present themselves as this repository.Breaking changes
TARGET_USERSis renamed toMISSKEY_TARGET_USERS.learnVisibilitiesmoves tomisskey.learnVisibilities. The config file schema is now strict, so a leftover top-level key fails at startup instead of being silently ignored.Test plan
npm run typecheck,npm run lint,npm run format:check,npm test,npm run buildpass:yyyy/mm/ddstart date limited the backfill to posts after that dateTWITTER_TARGET_USERSset, and confirmed the error when neither target variable is set