redouane59 / twittered

Twitter API client for Java developers
Apache License 2.0
235 stars 64 forks source link

getTweet(String tweetId) mediaUrl has no value #398

Closed lichao23 closed 1 year ago

lichao23 commented 1 year ago

I posted a tweet with a video at https://twitter.com/ I use getTweet(String tweetId), but mediaUrl has no value in the media object

 "media": [
                {
                    "type": "video",
                    "height": 544,
                    "width": 960,
                    "url": null,
                    "end": -1,
                    "start": -1,
                    "mediaUrl": null,
                    "displayUrl": null,
                    "expandedUrl": null,
                    "id": -1,
                    "media_key": "7_1572885207459454980",
                    "duration_ms": 8473,
                    "preview_image_url": "https://pbs.twimg.com/ext_tw_video_thumb/1572885207459454980/pu/img/T6C3S214J9B4PJGG.jpg",
                    "public_metrics": {
                        "view_count": 4
                    },
                    "alt_text": null
                }
            ],
blizniukov commented 1 year ago

Unfortunately this is not library bug. In Twitter V2 api there no url video in response. I am also waiting this feature from twitter

lichao23 commented 1 year ago

Unfortunately this is not library bug. In Twitter V2 api there no url video in response. I am also waiting this feature from twitter

one way Add the variants to request parameter media.fields. You can get variants array. It has multiple display or playback variants, with different resolutions or formats.

media.fields : duration_ms,height,media_key,preview_image_url,public_metrics,type,url,width,alt_text,variants

{
    "includes": {
        "media": [
            {
                "height": 544,
                "public_metrics": {
                    "view_count": 6
                },
                "media_key": "7_1572885207459454980",
                "variants": [
                    {
                        "content_type": "application/x-mpegURL",
                        "url": "https://video.twimg.com/ext_tw_video/1572885207459454980/pu/pl/pbQWsEUXkw8ox3eV.m3u8?tag=12&container=fmp4"
                    },
                    {
                        "bit_rate": 2176000,
                        "content_type": "video/mp4",
                        "url": "https://video.twimg.com/ext_tw_video/1572885207459454980/pu/vid/960x544/DZ-3fUJBZ_WBYzs1.mp4?tag=12"
                    },
                    {
                        "bit_rate": 256000,
                        "content_type": "video/mp4",
                        "url": "https://video.twimg.com/ext_tw_video/1572885207459454980/pu/vid/476x270/4fqJCPyq5vWw9d5j.mp4?tag=12"
                    },
                    {
                        "bit_rate": 832000,
                        "content_type": "video/mp4",
                        "url": "https://video.twimg.com/ext_tw_video/1572885207459454980/pu/vid/634x360/QCk1u73hoHMr-YjB.mp4?tag=12"
                    }
                ],
                "duration_ms": 8473,
                "type": "video",
                "preview_image_url": "https://pbs.twimg.com/ext_tw_video_thumb/1572885207459454980/pu/img/T6C3S214J9B4PJGG.jpg",
                "width": 960
            }
        ],
blizniukov commented 1 year ago

Nice. this is what i need also. i will implement NOW

lichao23 commented 1 year ago

Nice. this is what i need also. i will implement NOW

Yes! come on! I will wait for you to release the latest version

blizniukov commented 1 year ago

Done, now waiting for release)

redouane59 commented 1 year ago

Yes we'll make a new release this month. I would like to wait for the new DM endpoint at the end of October. Stay tuned :)

lichao23 commented 1 year ago

If it's a quote from someone else's tweet the media image of the source tweet also doesn't have a url value @redouane59 @blizniukov

lichao23 commented 1 year ago

Yes we'll make a new release this month. I would like to wait for the new DM endpoint at the end of October. Stay tuned :)

I have been waiting for this version, our app needs to use it

redouane59 commented 1 year ago

I'll make a release now if you need it quickly, it's ok ;)

lichao23 commented 1 year ago

I'll make a release now if you need it quickly, it's ok ;)

Oh great!