Skip to content

Commit

Permalink
🚸 [twitter] ツイート探索範囲を30件に、同じユーザーからはサンプルを1ツイートに制限
Browse files Browse the repository at this point in the history
  • Loading branch information
ci7lus committed Jan 16, 2022
1 parent 7beae59 commit 20c31ca
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 10 additions & 1 deletion src/miraktest-twitter/components/Tweet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ export const TweetComponent: React.FC<{
q: serviceTags.join(" OR ") + " exclude:retweets",
locale: "ja",
result_type: "recent",
count: 30,
})
.then((tweets: Search | { data: Search }) => {
const statuses =
Expand All @@ -225,8 +226,16 @@ export const TweetComponent: React.FC<{
const lowServiceTags = serviceTags.map((tag) =>
tag.toLowerCase()
)
const sortedHashtags = Object.entries(
const dedupedByUser = Array.from(
statuses
.reduce((arr, status) => {
arr.set(status.user.id_str, status)
return arr
}, new Map<string, typeof statuses[0]>())
.values()
)
const sortedHashtags = Object.entries(
dedupedByUser
.map(
(status) =>
(
Expand Down
2 changes: 1 addition & 1 deletion src/miraktest-twitter/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export const TWITTER_META = {
id: TWITTER_PLUGIN_ID,
name: "Twitter",
author: "ci7lus",
version: "0.0.5",
version: "0.0.6",
description: "視聴中の番組に関連するツイートを投稿する",
}
export const TWITTER_TWEET_WINDOW_ID = `${TWITTER_PLUGIN_ID}.tweet`

0 comments on commit 20c31ca

Please sign in to comment.