Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use BetterTwitFix free API to get data from tweet in x.com #331

Open
Fred-Vatin opened this issue Jan 18, 2025 · 0 comments
Open

Use BetterTwitFix free API to get data from tweet in x.com #331

Fred-Vatin opened this issue Jan 18, 2025 · 0 comments
Labels
enhancement New feature or request

Comments

@Fred-Vatin
Copy link

Hi,

Currently, it is hard to relevant data for the selected tweet and its quote. Video source link can be reached (currently) with:

article[tabindex="-1"][data-testid="tweet"] > .css-175oi2r.r-eqz5dr.r-16y2uox.r-1wbh5a2 > .css-175oi2r.r-16y2uox.r-1wbh5a2.r-1ny4l3l > [class="css-175oi2r"] > [class="css-175oi2r"] > .css-175oi2r.r-9aw3ui.r-1s2bzr4 > .css-175oi2r.r-9aw3ui [data-testid="tweetPhoto"] video > source

[tabindex="-1"] is required to the get the selected tweet if it is an answer.

Video source format is src="blob:https://x.com/56a5be7e-9007-4877-bdd2-58f5cf0e799f". Obsidian can not play it.

The solution could be the use of api.vxtwitter.com in extractors/twitter.ts.

Example with this tweet that has video and quote with video. The api url is: https://api.vxtwitter.com/sibusawaeiiti/status/1879171794495742015

{
    "allSameType": true,
    "article": null,
    "combinedMediaUrl": null,
    "communityNote": null,
    "conversationID": "1879171794495742015",
    "date": "Tue Jan 14 14:20:43 +0000 2025",
    "date_epoch": 1736864443,
    "hasMedia": true,
    "hashtags": [],
    "lang": "ja",
    "likes": 2127,
    "mediaURLs": [
        "https://video.twimg.com/ext_tw_video/1879171688824528896/pu/vid/avc1/720x1066/SbpTwbj519EZPLZs.mp4"
    ],
    "media_extended": [
        {
            "altText": null,
            "duration_millis": 58932,
            "size": {
                "height": 1066,
                "width": 720
            },
            "thumbnail_url": "https://pbs.twimg.com/ext_tw_video_thumb/1879171688824528896/pu/img/9BPAwwIDmt9NBPSC.jpg",
            "type": "video",
            "url": "https://video.twimg.com/ext_tw_video/1879171688824528896/pu/vid/avc1/720x1066/SbpTwbj519EZPLZs.mp4"
        }
    ],
    "pollData": null,
    "possibly_sensitive": false,
    "qrt": {
        "allSameType": true,
        "article": null,
        "combinedMediaUrl": null,
        "communityNote": null,
        "conversationID": "1879165445707866119",
        "date": "Tue Jan 14 14:07:10 +0000 2025",
        "date_epoch": 1736863630,
        "hasMedia": true,
        "hashtags": [],
        "lang": "ja",
        "likes": 88,
        "mediaURLs": [
            "https://video.twimg.com/ext_tw_video/1879168310392324096/pu/vid/avc1/576x1024/456wLvOLl6XrOGAL.mp4"
        ],
        "media_extended": [
            {
                "altText": null,
                "duration_millis": 83966,
                "size": {
                    "height": 1024,
                    "width": 576
                },
                "thumbnail_url": "https://pbs.twimg.com/ext_tw_video_thumb/1879168310392324096/pu/img/8GCBkgVEnvkJfBni.jpg",
                "type": "video",
                "url": "https://video.twimg.com/ext_tw_video/1879168310392324096/pu/vid/avc1/576x1024/456wLvOLl6XrOGAL.mp4"
            }
        ],
        "pollData": null,
        "possibly_sensitive": false,
        "qrtURL": null,
        "replies": 0,
        "retweets": 50,
        "text": "@sibusawaeiiti な〜るほど🫱🫱",
        "tweetID": "1879168383423496436",
        "tweetURL": "https://twitter.com/e_cqwz/status/1879168383423496436",
        "user_name": "レあ",
        "user_profile_image_url": "https://pbs.twimg.com/profile_images/1827489158132293632/9SzNhVXE_normal.jpg",
        "user_screen_name": "e_cqwz"
    },
    "qrtURL": "https://twitter.com/i/status/1879168383423496436",
    "replies": 16,
    "retweets": 1118,
    "text": "な〜るホド🫱🫱",
    "tweetID": "1879171794495742015",
    "tweetURL": "https://twitter.com/sibusawaeiiti/status/1879171794495742015",
    "user_name": "渋沢 栄一郎🗣#NO SLIP NO LIFE",
    "user_profile_image_url": "https://pbs.twimg.com/profile_images/1384111848933314574/WzZ464Q7_normal.jpg",
    "user_screen_name": "sibusawaeiiti"
}

We have all we need. This API downside is it only works on public tweet. Twitter made their tweets scrapping very hard, maybe to force the use of their own API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant