How to get the link from blogger video by the video ID?

不问归期 提交于 2019-12-08 05:02:49

问题


I have found some sites that use their own domain to use embed videos from blogger, example: https://example.com/blogger/video-play.mp4?contentId=264f2ge544g86h49.

PS: https://example.com is not a domain hosted on blogger, it's outside blogger

264f2ge544g86h49 is the ID of a video uploaded to blogger.

How is it made? There's a tutorial? I did not find anything about it on https://developers.google.com/blogger/docs/3.0/using


回答1:


To summarize the solution that we reached in the comments above. This will require writing server-side logic in the language of your choice to extract the actual video link using the Video ID or Video Token.

The more complicated approach would be using the Video ID directly ( https://example.com/blogger/video-play.mp4?contentId=VideoID). You will need to write logic for interacting with Blogger API to edit/create a post using the VideoID that you get via the query parameter (obtained from https://example.com/blogger/video-play.mp4?contentId=VideoID). The blog post will have the following content -

<object id="BLOG_video-VideoID" class="BLOG_video_class" contentid="VideoID"></object>

Now accessing that particular post available in the public Blogger feed via

https://www.blogger.com/feeds/BLOGID/posts/default/POSTID?alt=json

From the content.$tproperty in the above JSON feed, it would be possible to extract the Video Token for the particular video.

Using the Video Token, send a GET request to -

https://www.blogger.com/video.g?token=VideoToken

It would be possible to extract the actual video URL by parsing the response. The response will be in HTML, the actual URL is present in the JavaScript object with the key play_url -

var VIDEO_CONFIG = {
    "thumbnail": "Thumbnail-URL",
    "iframe_id": "BLOGGER-video-VideoID-6712",
    "allow_resize": false,
    "streams": [{
        "play_url": "Actual-Video-URL",
        "format_id": 18
    }, {
        "play_url": "Actual-Video-URL-Higher-Resolution",
        "format_id": 22
    }]
};

A simpler approach would be starting directly with the Video Token as that would do away with the need for interacting with the Blogger API & Feeds completely.


Previously, it was possible to get the actual video link using only the Video ID (Using a format like https://www.blogger.com/video-play.mp4?contentId=VIDEOID). This meant that after uploading the video to Blogger, it wasn't required to publish a post. But starting around November 2018, Blogger shifted to a token-based video URL (like https://www.blogger.com/video.g?token=TOKEN). That token can only be known after the post containing the video is published. This change likely happened due to the Video Management option that Blogger introduced around the same time



来源:https://stackoverflow.com/questions/54758474/how-to-get-the-link-from-blogger-video-by-the-video-id

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!