Getting videos in DM’s
Videos are already included in Direct Messages entities as you can see in the example below. I am able to access those even without needing to provide OAuth headers, not sure why.
{
"id" : 700621577105317891,
"id_str" : "700621577105317891",
"created_at" : "Fri Feb 19 10:02:55 +0000 2016",
"sender_screen_name" : "ePirat",
/* … */
"sender_id_str" : "42290913",
"text" : " https:\/\/t.co\/ALfn70d5FO",
"recipient" : {
/* … */
},
"entities" : {
"media" : [
{
"id_str" : "700621382330126338",
"media_url_https" : "https:\/\/pbs.twimg.com\/dm_video_preview\/700621382330126338\/img\/oQSrt2k9hiQADMw6eq4MX5Qd6FYlxOvX2QxTzNDLy00.jpg",
"expanded_url" : "https:\/\/twitter.com\/messages\/media\/700621577105317891",
"id" : 700621382330126338,
"sizes" : {
"large" : {
"w" : 1024,
"h" : 576,
"resize" : "fit"
},
"medium" : {
"w" : 600,
"h" : 338,
"resize" : "fit"
},
"thumb" : {
"w" : 150,
"h" : 150,
"resize" : "crop"
},
"small" : {
"w" : 340,
"h" : 191,
"resize" : "fit"
}
},
"display_url" : "pic.twitter.com\/ALfn70d5FO",
"video_info" : {
"aspect_ratio" : [
16,
9
],
"duration_millis" : 4068,
"variants" : [
{
"bitrate" : 2176000,
"content_type" : "video\/mp4",
"url" : "https:\/\/video.twimg.com\/dm_video\/700621382330126338\/vid\/1280x720\/fjGgNK29EXxfp_FubhV1EyYD7LEoNjmP9KOQJLfvjJ8.mp4"
},
{
"bitrate" : 320000,
"content_type" : "video\/mp4",
"url" : "https:\/\/video.twimg.com\/dm_video\/700621382330126338\/vid\/320x180\/MGDfjxKSNO845tiu15qQZA1eKM2PxIo_V-e9FTB8B98.mp4"
},
{
"url" : "https:\/\/video.twimg.com\/dm_video\/700621382330126338\/pl\/GTPbYQI9Sf8VACW_kAQQs2kkFNGblo10aSX1mmPfacM.m3u8",
"content_type" : "application\/x-mpegURL"
},
{
"url" : "https:\/\/video.twimg.com\/dm_video\/700621382330126338\/pl\/GTPbYQI9Sf8VACW_kAQQs2kkFNGblo10aSX1mmPfacM.mpd",
"content_type" : "application\/dash+xml"
},
{
"bitrate" : 832000,
"content_type" : "video\/mp4",
"url" : "https:\/\/video.twimg.com\/dm_video\/700621382330126338\/vid\/640x360\/Kf5UduKLmmS3cRTefQjogn9d1Ma4O--8IPY6lU0B4I4.mp4"
}
]
},
"type" : "video",
"indices" : [
1,
24
],
"media_url" : "https:\/\/pbs.twimg.com\/dm_video_preview\/700621382330126338\/img\/oQSrt2k9hiQADMw6eq4MX5Qd6FYlxOvX2QxTzNDLy00.jpg",
"url" : "https:\/\/t.co\/ALfn70d5FO"
}
],
"symbols" : [
],
"user_mentions" : [
],
"urls" : [
{
"display_url" : "pic.twitter.com\/ALfn70d5FO",
"url" : "https:\/\/t.co\/ALfn70d5FO",
"indices" : [
1,
24
],
"expanded_url" : "https:\/\/twitter.com\/messages\/media\/700621577105317891"
}
],
"hashtags" : [
]
},
"sender" : {
/* … */
},
"sender_id" : 42290913
}
Sending videos in DMs
Sending videos in DMs is, like sending images, as far as I know not yet possible for third party clients.
(Getting “Not authorized to use this endpoint.”)