mirror of
https://github.com/Eyre-S/Coeur-Morny-Cono.git
synced 2025-04-29 17:42:06 +08:00
fix FXApi error
This commit is contained in:
parent
29730018b7
commit
f7ddcc9871
@ -49,6 +49,8 @@ object FXApi {
|
|||||||
implicit val decoder_FXPoolChoice: Decoder[FXPoolChoice] = deriveDecoder
|
implicit val decoder_FXPoolChoice: Decoder[FXPoolChoice] = deriveDecoder
|
||||||
implicit val decoder_FXPool: Decoder[FXPool] = deriveDecoder
|
implicit val decoder_FXPool: Decoder[FXPool] = deriveDecoder
|
||||||
implicit val decoder_FXTranslate: Decoder[FXTranslate] = deriveDecoder
|
implicit val decoder_FXTranslate: Decoder[FXTranslate] = deriveDecoder
|
||||||
|
implicit val decoder_FXFacet: Decoder[FXFacet] = deriveDecoder
|
||||||
|
implicit val decoder_FXRawText: Decoder[FXRawText] = deriveDecoder
|
||||||
implicit val decoder_FXTweet_media: Decoder[FXTweet.mediaType] = deriveDecoder
|
implicit val decoder_FXTweet_media: Decoder[FXTweet.mediaType] = deriveDecoder
|
||||||
implicit val decoder_FXTweet: Decoder[FXTweet] = deriveDecoder
|
implicit val decoder_FXTweet: Decoder[FXTweet] = deriveDecoder
|
||||||
implicit val decoder_FXApi: Decoder[FXApi] = deriveDecoder
|
implicit val decoder_FXApi: Decoder[FXApi] = deriveDecoder
|
||||||
|
47
morny-coeur/src/main/scala/cc/sukazyo/cono/morny/social_share/external/twitter/FXFacet.scala
vendored
Normal file
47
morny-coeur/src/main/scala/cc/sukazyo/cono/morny/social_share/external/twitter/FXFacet.scala
vendored
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
package cc.sukazyo.cono.morny.social_share.external.twitter
|
||||||
|
|
||||||
|
/** The facets (rich text indicators) of the text.
|
||||||
|
*
|
||||||
|
* Every facet is a part of the original text, contains some extra information about the
|
||||||
|
* text segment.
|
||||||
|
*
|
||||||
|
* @param `type` The type of the facet.
|
||||||
|
* This may be one of the following (not fully listed):
|
||||||
|
*
|
||||||
|
* - `hashtag` - A hashtag (like #topic)
|
||||||
|
* - `media` - A media, like a photo or a video.
|
||||||
|
*
|
||||||
|
* @param indices The indices of the text segment in the original text.
|
||||||
|
*
|
||||||
|
* This should always be a list of two integers, the first one is the start
|
||||||
|
* index, and the second one is the end index of the text
|
||||||
|
* segment in the raw_text's text.
|
||||||
|
*
|
||||||
|
* @param original The original text of the facet.
|
||||||
|
* Should be the same with texts that the indices point to.
|
||||||
|
*
|
||||||
|
* The content type is different for each type:
|
||||||
|
* - for `media`, this is a media shortcode (like `t.co/abcde`).
|
||||||
|
* - for `hashtag`, this is the hashtag name without hash char (like `topic`,
|
||||||
|
* but not `#topic`).
|
||||||
|
*
|
||||||
|
* @param replacement Alternative method to show this facet.
|
||||||
|
*
|
||||||
|
* For now, only `media` have this field, and it is a URL that points to
|
||||||
|
* the media in the tweet (`https://x.com/user/status/123/photo/1`).
|
||||||
|
*
|
||||||
|
* @param display The display text of the facet.
|
||||||
|
*
|
||||||
|
* For now, only `media` have this field, and it seems like the permanent URL
|
||||||
|
* of the media (`pic.x.com/abcde`).
|
||||||
|
*
|
||||||
|
* @param id A very large integer ID of the facet. Seems only `media` have this field.
|
||||||
|
*/
|
||||||
|
case class FXFacet (
|
||||||
|
`type`: String,
|
||||||
|
indices: List[Int],
|
||||||
|
original: Option[String],
|
||||||
|
replacement: Option[String],
|
||||||
|
display: Option[String],
|
||||||
|
id: Option[String],
|
||||||
|
)
|
@ -6,11 +6,15 @@ package cc.sukazyo.cono.morny.social_share.external.twitter
|
|||||||
* @param url URL of the photo
|
* @param url URL of the photo
|
||||||
* @param width Width of the photo, in pixels
|
* @param width Width of the photo, in pixels
|
||||||
* @param height Height of the photo, in pixels
|
* @param height Height of the photo, in pixels
|
||||||
|
* @param altText Alternative text of the photo, or also known as photo description.
|
||||||
|
*
|
||||||
|
* It seems that this is not provided by Fix-Twitter API after 2025-04.
|
||||||
*/
|
*/
|
||||||
case class FXPhoto (
|
case class FXPhoto (
|
||||||
`type`: "photo",
|
`type`: "photo",
|
||||||
url: String,
|
url: String,
|
||||||
width: Int,
|
width: Int,
|
||||||
height: Int,
|
height: Int,
|
||||||
altText: String // todo
|
// todo: Find a tweet to test if this can still work
|
||||||
|
altText: Option[String]
|
||||||
)
|
)
|
||||||
|
13
morny-coeur/src/main/scala/cc/sukazyo/cono/morny/social_share/external/twitter/FXRawText.scala
vendored
Normal file
13
morny-coeur/src/main/scala/cc/sukazyo/cono/morny/social_share/external/twitter/FXRawText.scala
vendored
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
package cc.sukazyo.cono.morny.social_share.external.twitter
|
||||||
|
|
||||||
|
/** The raw text of the tweet.
|
||||||
|
*
|
||||||
|
* Contains all information that you want to know about the tweet content.
|
||||||
|
*
|
||||||
|
* @param text The text-formatted tweet content. Medias is also attached as a URL in the text.
|
||||||
|
* @param facets The facets (rich text information) of the text.
|
||||||
|
*/
|
||||||
|
case class FXRawText (
|
||||||
|
text: String,
|
||||||
|
facets: List[FXFacet]
|
||||||
|
)
|
@ -7,7 +7,10 @@ import cc.sukazyo.cono.morny.system.utils.EpochDateTime.EpochSeconds
|
|||||||
*
|
*
|
||||||
* @param id Status (Tweet) ID
|
* @param id Status (Tweet) ID
|
||||||
* @param url Link to original Tweet
|
* @param url Link to original Tweet
|
||||||
* @param text Text of Tweet
|
* @param text Text of Tweet. May not contains some extra information like URLs.
|
||||||
|
* @param raw_text Raw text of Tweet, contains a full article text and facets (rich information).
|
||||||
|
* Comparing with the `text` field, this contains all information that you want
|
||||||
|
* to know, like even the media is included.
|
||||||
* @param created_at Date/Time in UTC when the Tweet was created
|
* @param created_at Date/Time in UTC when the Tweet was created
|
||||||
* @param created_timestamp Date/Time in UTC when the Tweet was created
|
* @param created_timestamp Date/Time in UTC when the Tweet was created
|
||||||
* @param color Dominant color pulled from either Tweet media or from the author's profile picture.
|
* @param color Dominant color pulled from either Tweet media or from the author's profile picture.
|
||||||
@ -39,6 +42,7 @@ case class FXTweet (
|
|||||||
id: String,
|
id: String,
|
||||||
url: String,
|
url: String,
|
||||||
text: String,
|
text: String,
|
||||||
|
raw_text: FXRawText,
|
||||||
created_at: String,
|
created_at: String,
|
||||||
created_timestamp: EpochSeconds,
|
created_timestamp: EpochSeconds,
|
||||||
is_note_tweet: Boolean, // todo
|
is_note_tweet: Boolean, // todo
|
||||||
|
Loading…
Reference in New Issue
Block a user