问题
I work on a facebook-like social network and would need to extract the mp4 from an Instagram link.
For photos it was easy: url_shared = "http://instagram.com/p/a69ygTTHKq/" photo_to_embed = url_shared+"?size=t"
Do you know anything similar to find out a direct link to the mp4? I tried using their API and changing the extension from ".jpg" to ".mp4" but failed as it doesn't work all the time.
For example:
http://api.instagram.com/oembed?url=http://instagram.com/p/bCgbJ2pgCi/ returns
{
provider_url: "http://instagram.com/",
media_id: "487094313204187298_9762431",
title: "So did you download our "Hockey Community" app yet? If you like hockey even just a bit you should do it now!!'",
url: "http://distilleryimage2.ak.instagram.com/d79af376deb011e2922a22000a1fdc29_7.jpg",
author_name: "hockeycommunity",
height: 612,
width: 612,
version: "1.0",
author_url: "http://instagram.com/hockeycommunity",
author_id: 9762431,
type: "photo",
provider_name: "Instagram"
}
data.url = "http://distilleryimage2.ak.instagram.com/d79af376deb011e2922a22000a1fdc29_7.jpg" and the video link is actually "http://distilleryimage2.ak.instagram.com/d79af376deb011e2922a22000a1fdc29_101.mp4"
Only the end of the filename changes but can't figure out what's the rule...
Source:
- http://instagram-engineering.tumblr.com/post/53880734833/moving-pictures-capturing-moments-with-video
- http://instagram.com/developer/embedding/
回答1:
Instagram just released exactly what I was looking for: http://blog.instagram.com/post/55095847329/introducing-instagram-web-embeds
回答2:
The Instagram video is simply a new object in the JSON feed called "video". There is actually a plugin already avaialble for download that pulls in the video. You could probably just sample the code here to see how its done. Or just use the plugin since its already doing the job.
Jquery Instagram Video Plugin
来源:https://stackoverflow.com/questions/17352820/how-to-find-the-mp4-video-link-from-an-instagram-link