User:Vanderven.se martijn/feed-entries-with-post-type-video
I follow a lot of streamers on Twitch. My voice can be heard in multiple Mixer streams. I like many channels on YouTube. To support those artists I follow (“subscribe”, etc.) their channels within those silos. But I consume the actual content by subscribing to their Atom feeds (YouTube has some weird mapping for this) in my reader.
In swoops Telia and takes away my internet. Now I move a lot of video content aside in my reader. They sit there, waiting for me to leech off of someone else’s internet to be watched or downloaded.
But why can’t I have my reader sort out all video posts by itself? That would save me time. And maybe I can then also create something that automatically downloads things. So how do I know which posts are video posts? A beautiful use-case for Tantek Çelik’s post type discovery!
If the post has a "video" property with a valid URL,
Then it is a video post.
But how do I detect a video
property? I first thought I should create a converter from YouTube (their Atom, API, oEmbed, Schema.org, …) to h-feed. But as far as I could find a video
property is always a URL to a video file in microformats. Outsourcing video hosting to specialised silos (almost) always means there is no video file to link to.
The next feed format I looked at (also on the list from post type discovery) is jf2. This offers an interesting example, where the video
property can be more descriptive than just the URL:
{ "type": "entry", "video": [ { "content-type": "video/mp4", "url": "sample_h264.mov" } ] }
By a happy accident Microsub, “a standardized way for clients to consume and interact with feeds”, also builds on jf2! So not only have I found a feed format that (in its current draft iteration) supports video posts, but it can also be served by the server over an interoperable format to readers implementing the draft Microsub specification.
I am now planning to link the video through its embeddable URL, as almost every video silo has one of those. I will then set the content-type
to text/html
. A reader can use this to know that it should load the video in an iframe
instead of video
element. Much like how it might learn in the future that certain types cannot be rendered by a browser at all and might skip them completely instead of forcing it into a video
element.
Looking closely at what data can be scraped from a YouTube video post permalink, I discovered the people at Google had exactly the same idea! They leverage the Open Graph protocol’s structured properties by setting the following meta
elements:
<meta property="og:type" content="video">
<meta property="og:video:url" content="https://www.youtube.com/embed/ZTIwTVPo-sU">
<meta property="og:video:secure_url" content="https://www.youtube.com/embed/ZTIwTVPo-sU">
<meta property="og:video:type" content="text/html">
So now I am teaching XRay to extract jf2 compatible entries from YouTube URLs. I am hoping for an output akin to the following:
{
"type": "entry",
"name": "What is the IndieWeb - Keynote - IndieWeb Summit 2017",
"url": "https://www.youtube.com/watch?v=UAfjDXc1U0w",
"author": {
"type": "card",
"name": "IndieWebCamp",
"photo": "https://yt3.ggpht.com/-V4bGNJhcSlc/AAAAAAAAAAI/AAAAAAAAAAA/ObnfgHTttqI/s288-c-k-no-mo-rj-c0xffffff/photo.jpg",
"url": "https://www.youtube.com/channel/UCco4TTt7ikz9xnB35HrD5gQ"
},
"video": [
{
"content-type": "text/html",
"url": "https://www.youtube.com/embed/UAfjDXc1U0w"
}
],
"photo": [
"https://i.ytimg.com/vi/UAfjDXc1U0w/maxresdefault.jpg"
],
}
Wish me luck~
External links
- 2017-07-08 : Bookmarks, favs, likes - backfilling years of gaps (archived)
- 2017-07-16 : What is with my internet connection? (archived)
- 2017-08-01 : Post Type Discovery (archived)
- 2017-10-26 : JF2 Post Serialization Format (archived)
- 2017-07-27 : The Open Graph protocol (archived)
Other formats
- Kevin Marks points out that
rel
-URLs in microformats could parse resource type as well.- 2017-05-30 microformats2 parsing brainstorming (archived)
- JSON Feed’s attachments also support defining the linked resource’s type in a
mime_type
property.- 2017-05-28 : JSON Feed Version 1 (archived)
- Sven Knebel found a POSSE’d tweet from a video post where the video is hosted on YouTube but still got embedded in the tweet thanks to the Twitter Card Player Card markup.
- 2018-01-21 : adlerweb|BitBastelei on Twitter (archived)
- 2018-01-21 : BitBastelei #270 - Lii-500 Batterieladegerät (18650, Ni-HM, etc) (archived)
- Player card — Twitter Developers (archived) :
- The Twitter card markup lets you set an HTML file as
twitter:player
that will be embedded in Twitter. Additionallytwitter:player:stream
may be specified to point to the actual streamable resource, but can be omitted in case a silo video player is being embedded. The nested property format is very much like OGP. From Adlerweb:<meta name="twitter:card" content="player"> <meta name="twitter:player" content="https://www.youtube.com/embed/SmpG4biWRew"> <meta name="twitter:player:stream:content_type" content="video/mp4; codecs="avc1.42E01E1, mp4a.40.2""> <meta name="twitter:player:width" content="435"> <meta name="twitter:player:height" content="251">