twitrssme icon indicating copy to clipboard operation
twitrssme copied to clipboard

"GIF" videos support

Open gjedeer opened this issue 8 years ago • 5 comments

I don't know Perl so no pull request from me, but I'd like to see support for short videos like the ones on this user's timeline: https://twitter.com/MachinePix

It's implemented in an ugly way, there's an iframe containing the actual video.

<iframe src="https://twitter.com/i/videos/tweet/823700114963238912?embed_source=clientlib&amp;player_id=9&amp;rpc_init=1" allowfullscreen="" id="player_tweet_823700114963238912" style="width: 100%; height: 100%; position: absolute; top: 0; left: 0;"></iframe>

The iframed HTML document contains a video URL in a JSON object contained in a HTML attribute - there's a div with id="playerContainer" which has a "data-config" attribute that I've pasted below.

It seems that a Referer header needs to be spoofed too, the iframed URL doesn't load when opened in a new tab.

{
  "scribe_widget_origin": true,
  "heartbeatEnabled": true,
  "video_url": "https:\/\/video.twimg.com\/tweet_video\/C2-mZ2jUoAAZpQh.mp4",
  "videoInfo": {
    "title": null,
    "description": null,
    "publisher": {
      "screen_name": "MachinePix",
      "name": "Machine Pix",
      "profile_image_url": "https:\/\/pbs.twimg.com\/profile_images\/739515667737645056\/Rg0anujY_normal.jpg"
    }
  },
  "cardUrl": "https:\/\/t.co\/pRsq1JQl1D",
  "content_type": "video\/mp4",
  "owner_id": "2444425802",
  "looping_enabled": true,
  "show_cookie_override_en": true,
  "scribe_playlist_url": "https:\/\/twitter.com\/MachinePix\/status\/824060290958376961\/photo\/1",
  "source_type": "gif",
  "image_src": "https:\/\/pbs.twimg.com\/tweet_video_thumb\/C2-mZ2jUoAAZpQh.jpg",
  "heartbeatIntervalInMs": 5000,
  "use_tfw_live_heartbeat_event_category": true,
  "video_loading_timeout": 45000,
  "status": {
    "created_at": "Wed Jan 25 01:04:18 +0000 2017",
    "id": 8.2406029095838e+17,
    "id_str": "824060290958376961",
    "text": "Making springs with a CNC wire bender. https:\/\/t.co\/pRsq1JQl1D",
    "truncated": false,
    "entities": {
      "hashtags": [
        
      ],
      "symbols": [
        
      ],
      "user_mentions": [
        
      ],
      "urls": [
        {
          "url": "https:\/\/t.co\/pRsq1JQl1D",
          "expanded_url": "https:\/\/twitter.com\/MachinePix\/status\/824060290958376961\/photo\/1",
          "display_url": "pic.twitter.com\/pRsq1JQl1D",
          "indices": [
            39,
            62
          ]
        }
      ]
    },
    "source": "<a href=\"http:\/\/twitter.com\" rel=\"nofollow\">Twitter Web Client<\/a>",
    "in_reply_to_status_id": 8.040322597874e+17,
    "in_reply_to_status_id_str": "804032259787395073",
    "in_reply_to_user_id": 2444425802,
    "in_reply_to_user_id_str": "2444425802",
    "in_reply_to_screen_name": "MachinePix",
    "geo": null,
    "coordinates": null,
    "place": null,
    "contributors": null,
    "retweet_count": 0,
    "favorite_count": 0,
    "favorited": false,
    "retweeted": false,
    "possibly_sensitive": false,
    "lang": "en"
  },
  "show_cookie_override_all": true,
  "video_session_enabled": false,
  "media_id": "824060219902697472",
  "statusTimestamp": {
    "local": "1:04 AM - 25 Jan 2017"
  },
  "user": {
    "screen_name": "MachinePix",
    "name": "Machine Pix",
    "profile_image_url": "https:\/\/pbs.twimg.com\/profile_images\/739515667737645056\/Rg0anujY_bigger.jpg"
  },
  "tweet_id": "824060290958376961"
}

gjedeer avatar Jan 26 '17 21:01 gjedeer

Its a nice idea. I will have to have a think about whether embedded videos mean changing the RSS format so that it loses backwards compatibility with the v1 API. And also have a dig round in the RSS spec for how to add media (IIRC its a bit of a mess). Thanks for the detailed FR by the way :-)

ciderpunx avatar Jan 27 '17 08:01 ciderpunx

An RSS attachment may be one way to do it, I'm not that sure how existing readers implement this though.

gjedeer avatar Jan 27 '17 08:01 gjedeer

Media RSS would be a good approach. Podcasters use that extension for while now.

aggsol avatar Apr 06 '17 15:04 aggsol

Heck, at the moment, even just displaying images (jpg, gif etc) from tweets would be a huge step forward. Displaying video would be nice, but how about covering the basics like images first?

Bugsbane avatar Jun 07 '17 08:06 Bugsbane

It is funny you say that, I use AntennaPod and I can view images with it. here's an image as a proof. What do you think?

doronbehar avatar Jun 07 '17 11:06 doronbehar