Skip to content

Commit

Permalink
Merge branch 'release/0.8.7'
Browse files Browse the repository at this point in the history
  • Loading branch information
nleush committed Aug 4, 2015
2 parents c165eaa + ad583ae commit 078e9b9
Show file tree
Hide file tree
Showing 55 changed files with 461 additions and 630 deletions.
12 changes: 12 additions & 0 deletions WHATSNEW.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@ This is the history of the Iframely changes. Updates that are older than one yea

Stay tuned, either by watching [Iframely on GitHub](https://github.com/itteco/iframely) or following [Iframely on Twitter](https://twitter.com/iframely).


### 2015.07.03, Version 0.8.7

- Cleanup and maintenance of domain plugins
- New domains: Datawrapper, Widgetic
- Option to send params for individual oEmbed providers (`ADD_OEMBED_PARAMS` in sample config)
- General config option to group Iframely JSON's links by rel by default (`GROUP_LINKS`)
- `media=1` optional query string API param that will make Iframely try to return actual media. Ex: Instagram MP4 video instead of status embed
- Direct URLs to office docs are now proxied by Google Docs Viewer



### 2015.06.08, Version 0.8.6

Changes to existing publishers:
Expand Down
3 changes: 3 additions & 0 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
// Default cache engine to prevent warning.
CACHE_ENGINE: 'node-cache',
CACHE_TTL: 24 * 60 * 60,
IMAGE_META_CACHE_TTL: 7 *24 * 60 * 60,

CACHE_TTL_PAGE_TIMEOUT: 10 * 60,
CACHE_TTL_PAGE_404: 10 * 60,
Expand Down Expand Up @@ -159,6 +160,8 @@
],

OEMBED_RELS_PRIORITY: ["app", "player", "survey", "image", "reader"],
OEMBED_RELS_MEDIA_PRIORITY: ["player", "survey", "image", "reader", "app"],

providerOptions: {
"readability": {},
"twitter.status": {}
Expand Down
21 changes: 21 additions & 0 deletions config.local.js.SAMPLE
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@
baseAppUrl: "http://yourdomain.com",
relativeStaticUrl: "/r",

// For legacy reasons the response format of Iframely open-source is
// different by default as it does not group the links array by rel.
// In order to get the same grouped ressonse as in Cloud API,
// add `&group=true` to your request to change response per request
// or set `groupLinks` in your config to `true` for a global change.
GROUP_LINKS: false,

SKIP_OEMBED_RE_LIST: [
// /^https?:\/\/yourdomain\.com\//,
],
Expand Down Expand Up @@ -69,6 +76,15 @@
// If there's no response from remote server, the timeout will occur after
RESPONSE_TIMEOUT: 5 * 1000, //ms

// Customize API calls to oembed endpoints.
ADD_OEMBED_PARAMS: [{
// Endpoint url regexp array.
re: [/^http:\/\/api\.instagram\.com\/oembed/],
// Custom get params object.
params: {
hidecaption: true
}
}],

// Customize API calls to 3rd parties. At the very least - configure required keys.
providerOptions: {
Expand Down Expand Up @@ -123,6 +139,11 @@
},
vimeo: {
get_params: "?byline=0&badge=0" // http://developer.vimeo.com/player/embedding
},

facebook: {
//https://www.facebook.com/translations/FacebookLocales.xml
language_code: 'en_US'
}
},

Expand Down
70 changes: 38 additions & 32 deletions docs/API.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
# Iframely API for Responsive Embeds and Unified Meta

You send Iframely an URL via HTTP GET request. Iframely will return you semantics `meta` and embeds `links`, which both mimic the `<head>` elements of the web page requested.
You send Iframely an URL via HTTP GET request. Iframely will return you semantics and attribution `meta` data and embeds `links`. Together, they mimic the `<head>` element of requested web page.

Iframely will generate those elements from a variety of sources, including oEmbed, Twitter Cards, Open Graph, microformats and custom domain parsers.

Embed codes are given in `html` values for each link or, for the primary media option only, duplicated at the root level. The embed codes will be wrapped into responsive divs whenever possible.
Embed codes are given in `html` values for each link or, for the primary media option only, duplicated at the root level. Embed codes will be wrapped into responsive divs whenever possible.

## API Request

[>> http://iframe.ly/api/iframely?url=… &api_key= …](http://iframe.ly/api/iframely?url=http://iframe.ly/ACcM3Y).

- `url` and `api_key` parameters are required.
- `url` needs to be URL-encoded.
- `api_key` isn’t required if URL is from `iframe.ly/*` domain.
- for enhanced security, `api_key` can be substituted with `key` parameter, which should be the md5 hash value of your API key.


If you're making API calls via JavaScript, and your site uses SSL, change API address to `https://`. For server-server communications, HTTP is generally faster as it doesn't require additional handshakes.

## API Response

[>> Here’s Iframely API response for Coub](http://iframe.ly/api/iframely?url=http://iframe.ly/ACcM3Y)
[>> Here’s sample Iframely API response for Coub](http://iframe.ly/api/iframely?url=http://iframe.ly/ACcM3Y)


{
"id": "ACcM3Y", -- short ID if you request iframe=true
"id": "ACcM3Y", // short URL ID, if available
// plus canonical URL
"url": "http://coub.com/view/2pc24rpb",

-- rel use cases and html code for primary variant of embed,
"rel": ["player", "ssl"], -- check it for `autoplay` if you request it
"html": "<div style=\"left: 0px; width: 100%; height: 0px; position: relative; padding-bottom: 56.2493%;\"><iframe src=\"//coub.com/embed/2pc24rpb\" style=\"top: 0px; left: 0px; width: 100%; height: 100%; position: absolute;\"></iframe></div>"
// rel use cases and html code for primary variant of embed,
"rel": ["player", "ssl"], // check for `autoplay` if you request it
"html": "<div ... </div>"

"meta": { -- meta object with the semantics
"title": "PARADISE BEACH", -- e.g. title and others
// meta object with attribution semantics
"meta": {
"title": "PARADISE BEACH",
"description": "Ilya Trushin",
"author_url": "http://coub.com/trucoubs",
"author": "Ilya Trushin",
Expand All @@ -40,53 +40,59 @@ If you're making API calls via JavaScript, and your site uses SSL, change API ad
"keywords": "living photo, ... , media"
},

-- Plus list of embed src links with functional rels . For example,
// Plus list of embed src links with functional rels . For example,
"links": {
"player": [{ -- List of player embed widgets
"media": { -- Media query aspects
"player": [{ // List of player embed widgets
"media": { // Media query, e.g. aspects
"aspect-ratio": 1.777778
},
-- SRC of embed.
// SRC of embed.
"href": "//coub.com/embed/2pc24rpb",

// functional and technical use cases.
"rel": ["player", "ssl", "html5"],
"type": "text/html" -- link’s MIME type
-- Plus generated HTML code for simplicity of use.
"html": "<div style=\"left: 0px; width: 100%; height: 0px; position: relative; padding-bottom: 56.2493%;\"><iframe src=\"//coub.com/embed/2pc24rpb\" style=\"top: 0px; left: 0px; width: 100%; height: 100%; position: absolute;\"></iframe></div>"

// link’s MIME type, says "embed as iFrame".
"type": "text/html",

// plus generated HTML code for simplicity of use:
"html": "<div ... </div>"
}, {
...
-- Might have multiple variations of the same player.
-- E.g. one that 'autoplay's, one as MP4 video, one with https src.
// Might have multiple variations of the same player.
// Say, one that 'autoplay's, one as MP4 video, one as https.
}],
"thumbnail": [{
"media": {
"height": 360, -- Exact sizes here.
"height": 360, // Exact sizes here.
"width": 640
}, -- We repeat the same rel
"rel": ["thumbnail"], -- as iframely.js needs it.
"type": "image", -- "use href as src of image"
}, // We repeat the same rel
"rel": ["thumbnail"], // as iframely.js needs it.
"type": "image", // "use href as src of image"
"href": "http://cdn1.aka ... med_1381670134_00040.jpg"
}, {
...
}],

-- Also possible:
-- app, image (as rel)
... -- reader, survey
-- logo (sometimes)
// Also possible:
// app, image (as rel)
... // reader, survey
// logo (rare)
"icon": [{
...
}]
},


- `rel` is the primary information about the use case of the embeds. Primary rels are Player, Thumbnail, App, Image, Reader, Survey, Summary, Icon and Logo. [See the detailed description of rels](https://iframely.com/docs/links).
- `rel` is the primary information about the use case of the embeds. Primary rels are `player`, `thumbnail`, `app`, `image`, `reader`, `survey`, `summary`, `icon` and `logo`. [See detailed description of rels](https://iframely.com/docs/links).

- `meta` will contain list of semantic attributes in unified naming format. See what Iframely unifies as [meta semantics](https://iframely.com/docs/meta).
- `meta` will contain list of semantic attributes in unified naming format. Read what Iframely unifies as [meta semantics here](https://iframely.com/docs/meta).


Array values that only have one element will be wrapped as single object (i.e. without `[]`).


*For open source users:*

- The API response format of [Iframely open-source](https://github.com/itteco/iframely) is a little different by default as it does not have the links array grouped by rel. This is for legacy reasons. To achieve exact same grouped response as in Cloud API, add `&group=true` to your request.
- The API response format of [Iframely open-source](https://github.com/itteco/iframely) is a little different by default as it does not have the links array grouped by rel. This is for legacy reasons. To achieve exact same grouped response as in Cloud API, add `&group=true` to your request or configure it in your settings.
18 changes: 13 additions & 5 deletions docs/LINKS.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,24 @@ Links are used as the raw data which you can use to select a widget. `html` fiel
Example of a link object:

{
"href": "//coub.com/embed/2pc24rpb", -- SRC of embed. The main attribute
// SRC of embed. The main attribute
"href": "//coub.com/embed/2pc24rpb",

// functional and technical use cases.
"rel": ["player", "autoplay", "html5"],
"type": "text/html", -- MIME type. Tells: "embed as iFrame"
"media": { -- Media query. Mostly responsive

// MIME type. Tells: "embed as iFrame"
"type": "text/html",

"media": { // Media query. Mostly responsive
"aspect-ratio": 1.777778
},
"html": "<div style=\"left: 0px; width: 100%; height: 0px; position: relative; padding-bottom: 56.2493%;\"><iframe src=\"//coub.com/embed/2pc24rpb\" style=\"top: 0px; left: 0px; width: 100%; height: 100%; position: absolute;\"></iframe></div>"

// plus generated or native HTML code:
"html": "<div ..></div>"
}

At times, Iframely will return `html` attribute without `href`. For example, for Twitter and Facebook Statuses, or elsewhere with very specific embed codes.
At times, Iframely will return `html` attribute without `href`. For example, for Twitter and Facebook Statuses, or elsewhere with very specific embed codes.

Also, Iframely does not generate `html` field for `image/*` MIME types.

Expand Down
8 changes: 5 additions & 3 deletions docs/PARAMS.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Optional API parameters


You may configure API to filter out rich media in [your API settings](https://iframely.com/settings). Or send the same filters in your query-string for each API call individually. If not given with an API call, your defaults will be used. If you haven't set up your preferences, the system-wide settings will be used.
You may configure API in [your API settings](https://iframely.com/settings). Plus send filters in your query-string for each API call individually. If not given with an API call, your defaults will be used. If you haven't set up your preferences, the cloud-wide settings will be used.


All these parameters are completely optional. If not given, you will still receive all relevant information in `rel` attributes of [Iframely API](https://iframely.com/docs/iframely-api) (not in [oEmbed](https://iframely.com/docs/oembed-api) though).
All these parameters are optional. If not given, you will still receive all relevant information in `rel` attributes of [Iframely API](https://iframely.com/docs/iframely-api) (not in [oEmbed](https://iframely.com/docs/oembed-api) though).


- `iframe=true` or `iframe=1` - activates [URL shortener](https://iframely.com/docs/url-shortener) and will return the hosted iframes or [summary cards](https://iframely.com/docs).
Expand All @@ -15,6 +15,8 @@ All these parameters are completely optional. If not given, you will still recei

- `html5=true` or `1`- will return only embeds that can be viewed on mobile devices or desktops without Flash plugin installed.

- `media=true` or `1`- "prefer media-only". For some publishers, Iframely knows status-like `app` embeds AND simple media, such as photos or video. This option will make Iframely return actual media in the `html` field instead of branded embeds. It affects, for example, Instagram, Tumblr, Imgur, Pinterest (for videos), etc.

- `maxwidth=` in pixels will return only embeds that do not exceed this width. It affects the rare cases of fixed-width embeds as in most cases Iframely gives the responsive embed codes. However, this parameter is important for Facebook posts and Pinterest, as it is passed into embed code of those providers to adjust its width.

- `origin=` - optional tag text value that will help you later search links in your dashboard. It represents the hashtag E.g. project or chat room name, category, app, if you got several, etc.
Expand All @@ -26,7 +28,7 @@ Also, for [oEmbed API](https://iframely.com/docs/oembed-api) only:

- there's `format=xml` parameter - if you'd like to get your oEmbed as XML.

- But no `autoplay` parameter. oEmbed never returns the media that autoplays. However, If you're wrapping embed codes with [short URL](https://iframely.com/docs/url-shortener) iFrames using API with `iframe=true`, the autoplay media will be returned with a fallback to [summary card](https://iframely.com/docs/widgets).
- But no `autoplay` parameter. oEmbed never returns the media that autoplays. However, If you're wrapping embed codes with [smart iFrames](https://iframely.com/docs/iFrames) using API with `iframe=true`, the autoplay media will be returned with a [special card](https://iframely.com/docs/widgets).



14 changes: 7 additions & 7 deletions docs/oEmbed.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
# oEmbed API

Iframely gives you a classic [oEmbed](http://oembed.com) v1 endpoint, where you send a URL and get embed codes in response. The HTML embed codes will be responsive, if possible.
Iframely gives you a classic [oEmbed v1](http://oembed.com) endpoint, where you send your URL and get embed codes in response. The HTML embed codes will be responsive in most cases, whenever possible.

Read details of oEmbed on [http://oembed.com](http://oembed.com). Basically, you just want to look for `html` field of response. However beware, `photo` type in oEmbed gives image resource as `url` field rather than in `html`.
Read details of oEmbed spec on [oembed.com](http://oembed.com). Basically, you just want to look for `html` field of API response. However beware, `photo` type of oEmbed gives image resource as `url` field rather than as `html`.

This article gives you all you need to know about oEmbed implementation in Iframely. All other articles will relate to [Iframely API](https://iframely.com/docs/iframely-api).
This article gives you all you need to know about oEmbed implementation in Iframely. All other articles will relate to more detailed [Iframely API](https://iframely.com/docs/iframely-api) format.

## API Request

[>> http://iframe.ly/api/oembed?url=… &api_key= …](http://iframe.ly/api/oembed?url=http://iframe.ly/ACcM3Y).

- `url` and `api_key` parameters are required.
- `url` needs to be URL-encoded.
- `api_key` isn’t required if URL is from `iframe.ly/*` domain.
- for enhanced security, `api_key` can be substituted with `key` parameter, which should be the md5 hash value of your API key.


If you're making API calls via JavaScript, and your site uses SSL, change API address to `https://`. For server-server communications, HTTP is generally faster as it doesn't require additional handshakes.
If you're making API calls via JavaScript, and your site uses SSL, change API address to `https://`. For server-server communications, HTTP is generally faster as it doesn't require additional handshake.

## API Response

[>> Here’s oEmbed response for Coub](http://iframe.ly/ACcM3Y.oembed)
[>> Here’s sample oEmbed response for Coub](http://iframe.ly/ACcM3Y.oembed)

{
"url": "http://coub.com/view/2pc24rpb",
Expand All @@ -32,7 +32,7 @@ If you're making API calls via JavaScript, and your site uses SSL, change API ad
"thumbnail_url": "http://cdn1 ... /med_1381670134_00040.jpg",
"thumbnail_width": 640,
"thumbnail_height": 360,
"html": "<div class=\"iframely-widget-container\" style=\"left: 0px; width: 100%; height: 0px; position: relative; padding-bottom: 56.243%;\"><iframe class=\"iframely-widget iframely-iframe\" src=\"//coub.com/embed/2pc24rpb\" frameborder=\"0\" allowfullscreen=\"true\" webkitallowfullscreen=\"true\" mozallowfullscreen=\"true\" style=\"top: 0px; left: 0px; width: 100%; height: 100%; position: absolute;\"></iframe></div>",
"html": "<div style=\"left: 0px; width: 100%; height: 0px; position: relative; padding-bottom: 56.243%;\"><iframe src=\"//coub.com/embed/2pc24rpb\" style=\"top: 0px; left: 0px; width: 100%; height: 100%; position: absolute;\"></iframe></div>",
}

`photo`, `video` and `rich` types are supported as oEmbed output. If Iframely doesn't have any embed codes for a given URL, oEmbed will return `link` type object.
2 changes: 1 addition & 1 deletion lib/cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
setCachingEngine(DEFAULT_CACHE);
}
}
};
}

setCachingEngine(CONFIG.CACHE_ENGINE || DEFAULT_CACHE);

Expand Down
7 changes: 7 additions & 0 deletions lib/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -939,6 +939,13 @@

i++;
}

if (link.type.indexOf('video/') === 0) {
var autoplayIdx = link.rel.indexOf(CONFIG.R.autoplay);
if (autoplayIdx > -1) {
link.rel.splice(autoplayIdx, 1);
}
}
}

// Sort links.
Expand Down
Loading

0 comments on commit 078e9b9

Please sign in to comment.