twitter-openapi
twitter-openapi copied to clipboard
ArticleResult.cover_media should not be required
ArticleResult.cover_media is defined as required here:
https://github.com/fa0311/twitter-openapi/blob/main/src%2Fopenapi%2Fschemas%2Ftweet.yaml#L1435
But here is a tweet that doesn't have it:
https://x.com/Steve_Yegge/status/1948284140757057763
This causes a deserialization error when attempting to fetch the tweet.
To be precise, here is the relevant JSON structure of that ArticleResult.
In addition to cover_media not existing in the JSON (which causes a deserialization error), the content_state and media_entities fields don't exist in the model (which means I have to go through the raw TweetApiUtilsData). I'll open a separate issue for that when I get to it.
{
"rest_id": "1948276165103300609",
"id": "QXJ0aWNsZUVudGl0eToxOTQ4Mjc2MTY1MTAzMzAwNjA5",
"title": "Another Week with Coding Agents",
"preview_text": "There's an old Usenet quote that was popular in the early 90s: Morning is a beautiful time for programmers — to see the sun rising and say, ‘That was a good night’s work.’\nIt's getting late, 1am",
"content_state": {
"blocks": [
{
"key": "9q2dg",
"data": {},
"entityRanges": [],
"inlineStyleRanges": [],
"text": "There's an old Usenet quote that was popular in the early 90s: Morning is a beautiful time for programmers — to see the sun rising and say, ‘That was a good night’s work.’",
"type": "unstyled"
},
{
"key": "c7i73",
"data": {},
"entityRanges": [],
"inlineStyleRanges": [],
"text": "It's getting late, 1am almost and I'm supposed to be golfing at 7am, but I'm pretty much hogtied to my chair by my four coding agents. They're all getting exceptionally good at their jobs. Four is about the max I can handle right now, though, since they still need a lot of handholding at all times.",
"type": "unstyled"
},
{
"key": "a5f93",
"data": {
"mentions": [
{
"fromIndex": 6,
"toIndex": 14,
"text": "AmpCode"
}
]
},
"entityRanges": [],
"inlineStyleRanges": [
{
"length": 9,
"offset": 183,
"style": "Italic"
}
],
"text": "I use @AmpCode exclusively these days. I keep meaning to go check out what's new with Claude Code, but my agents have me at gunpoint. They won't let me leave the room. I mean they're so good. After a while you really build up some trust. I haven't opened an IDE in at least a month, but my coding is through the roof. And I see new patterns emerging every week.",
"type": "unstyled"
},
// ...
// Leaving out a couple of blocks here for brevity
// ...
{
"key": "3mem6",
"data": {},
"entityRanges": [],
"inlineStyleRanges": [],
"text": "Let me know what you think. Is this stuff worth hearing about? Should I make a video? Anyone want to help vibe code Efrit with me?",
"type": "unstyled"
}
],
"entityMap": [
{
"key": "0",
"value": {
"type": "MEDIA",
"mutability": "Immutable",
"data": {
"caption": "Efrit produces a Vim-themed ode on the left and sonnet on the right",
"entityKey": "2af01863-8553-4b63-ab66-4e052bd8d5ee",
"mediaItems": [
{
"localMediaId": "1",
"mediaCategory": "DraftTweetImage",
"mediaId": "1948278435681579008"
}
]
}
}
}
]
},
"media_entities": [
{
"id": "QXBpTWVkaWE6DAAFCgABGwms6jJasAAKAAIAAAAAGZqtbQAA",
"media_key": "3_1948278435681579008",
"media_id": "1948278435681579008",
"media_info": {
"__typename": "ApiImage",
"original_img_height": 544,
"original_img_width": 1540,
"original_img_url": "https://pbs.twimg.com/media/Gwms6jJasAAq7M2.jpg",
"color_info": {
"palette": [
{
"percentage": 73.4,
"rgb": {
"blue": 40,
"green": 40,
"red": 40
}
},
{
"percentage": 25.76,
"rgb": {
"blue": 247,
"green": 247,
"red": 247
}
}
]
}
}
}
],
"lifecycle_state": {
"modified_at_secs": 1753342490
},
"metadata": {
"first_published_at_secs": 1753342111
}
}