{"action":"created","issue":{"url":"https://api.github.com/repos/itteco/iframely/issues/76","labels_url":"https://api.github.com/repos/itteco/iframely/issues/76/labels{/name}","comments_url":"https://api.github.com/repos/itteco/iframely/issues/76/comments","events_url":"https://api.github.com/repos/itteco/iframely/issues/76/events","html_url":"https://github.com/itteco/iframely/issues/76","id":88348141,"number":76,"title":"Manually build an embed from datawrapper.de","user":{"login":"j0k3r","id":62333,"avatar_url":"https://avatars.githubusercontent.com/u/62333?v=3","gravatar_id":"","url":"https://api.github.com/users/j0k3r","html_url":"https://github.com/j0k3r","followers_url":"https://api.github.com/users/j0k3r/followers","following_url":"https://api.github.com/users/j0k3r/following{/other_user}","gists_url":"https://api.github.com/users/j0k3r/gists{/gist_id}","starred_url":"https://api.github.com/users/j0k3r/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/j0k3r/subscriptions","organizations_url":"https://api.github.com/users/j0k3r/orgs","repos_url":"https://api.github.com/users/j0k3r/repos","events_url":"https://api.github.com/users/j0k3r/events{/privacy}","received_events_url":"https://api.github.com/users/j0k3r/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-06-15T07:43:57Z","updated_at":"2015-06-15T13:29:47Z","closed_at":null,"body":"I added datawrapper.de to our internal fork of Iframely few days ago but I don't think I did it in the best way...\r\n\r\nFor the background, [datawrapper](https://datawrapper.de/) is an open source tool to create chart from a source. Once you've finished polishing your chart, you can only grab the embed code where the embed url look like this: http://cf.datawrapper.de/zjCKi/2/\r\n\r\nWhen I wanted to integrate it into Iframely, I noticed this line in the HTML source:\r\n\r\n```html\r\n<link rel=\"alternate\" type=\"application/json+oembed\" href=\"https://datawrapper.de/api/plugin/oembed?url=http%3A%2F%2Fcf.datawrapper.de%2FzjCKi%2F2%2F&amp;format=json\" title=\"Montant total des amendes infligées par les régulateurs américains\" />\r\n```\r\n\r\nWhich was perfect for Iframely! Sadly, it leads to a 404 ...\r\nI reached datawrapper support and they replyied:\r\n\r\n> There is a module allowing for oEmbed, but it is like half-baked right now. If possible we would like to postpone work on this, there are more urgent tasks\r\n\r\n:cry: \r\n\r\nSo I started digging in the plugin creation to handle it on my own.\r\nI created a file `plugins/domains/datawrapper.de.js` :\r\n\r\n```js\r\nmodule.exports = {\r\n    re: [\r\n        /^http[s]?:\\/\\/cf.datawrapper.de\\/(.+?)(?:[\\/](?:index\\.html)?)?$/\r\n    ],\r\n\r\n    mixins: [\r\n        \"html-title\"\r\n    ],\r\n\r\n    getLink: function(urlMatch, meta) {\r\n        return {\r\n            title: meta['html-title'],\r\n            type: CONFIG.T.text_html,\r\n            rel: CONFIG.R.inline,\r\n            // href: \"http://cf.datawrapper.de/\" + urlMatch[1] + \"/\",\r\n            html: '<iframe width=\"566\" height=\"400\" scrolling=\"no\" frameborder=\"0\" src=\"http://cf.datawrapper.de/' + urlMatch[1] + '/\"></iframe>'\r\n        }\r\n    },\r\n\r\n    getMeta: function(meta) {\r\n        return {\r\n            site: 'datawrapper',\r\n        };\r\n    },\r\n\r\n    tests: [\r\n        \"http://cf.datawrapper.de/zjCKi/2/\",\r\n        \"http://cf.datawrapper.de/Gx44C/21/\",\r\n        \"http://cf.datawrapper.de/RrO5t/2/\"\r\n    ]\r\n};\r\n```\r\n\r\nWhat I don't like in this snippet, is the way I manually built the iframe instead of letting Iframely to its job and wrapping it in a div, etc ..\r\n\r\nHow can I do that?"},"comment":{"url":"https://api.github.com/repos/itteco/iframely/issues/comments/112070665","html_url":"https://github.com/itteco/iframely/issues/76#issuecomment-112070665","issue_url":"https://api.github.com/repos/itteco/iframely/issues/76","id":112070665,"user":{"login":"iparamonau","id":28841,"avatar_url":"https://avatars.githubusercontent.com/u/28841?v=3","gravatar_id":"","url":"https://api.github.com/users/iparamonau","html_url":"https://github.com/iparamonau","followers_url":"https://api.github.com/users/iparamonau/followers","following_url":"https://api.github.com/users/iparamonau/following{/other_user}","gists_url":"https://api.github.com/users/iparamonau/gists{/gist_id}","starred_url":"https://api.github.com/users/iparamonau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iparamonau/subscriptions","organizations_url":"https://api.github.com/users/iparamonau/orgs","repos_url":"https://api.github.com/users/iparamonau/repos","events_url":"https://api.github.com/users/iparamonau/events{/privacy}","received_events_url":"https://api.github.com/users/iparamonau/received_events","type":"User","site_admin":false},"created_at":"2015-06-15T13:29:47Z","updated_at":"2015-06-15T13:29:47Z","body":".@nleush mentions that your regex matches, but there might be another issue at Iframely core here.\r\n\r\nThere is a validator at Iframely core that removes embeds with iframe src = canonical address (or original URL). In your case, the `urlMatch[1]` would be like `zjCKi/2` and you'll end up having iFrame exactly the same as URL (from your tests). \r\n\r\nThat validator is for generic parsers, especially for Open Graph. A lot of people just put og:video=canonical. Unfortunately, we can not remove this check. To work it around, you could add some query string to iFrame src, like `?for=iframely` or something."}}