From ed8d0436f41f6ef397c223eeead2950bedf073b2 Mon Sep 17 00:00:00 2001 From: Ivan Paramonau Date: Mon, 19 Dec 2016 15:46:51 -0500 Subject: [PATCH 01/50] domains: enable mixcloud on AWS --- plugins/domains/mixcloud.com.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 plugins/domains/mixcloud.com.js diff --git a/plugins/domains/mixcloud.com.js b/plugins/domains/mixcloud.com.js new file mode 100644 index 000000000..23bb49a56 --- /dev/null +++ b/plugins/domains/mixcloud.com.js @@ -0,0 +1,24 @@ +module.exports = { + + mixins: [ + "oembed-title", + "oembed-description", + "oembed-author", + "oembed-site", + "oembed-rich" + ], + + getLink: function (oembed) { + + return { + href: oembed.image, + type: CONFIG.T.image, + rel: CONFIG.R.thumbnail + } + + }, + + tests: [{ + noFeeds: true + }] +}; \ No newline at end of file From d6c3e4fff60ca9e47dfc992ad7191d073a72b067 Mon Sep 17 00:00:00 2001 From: Ivan Paramonau Date: Thu, 22 Dec 2016 11:18:31 -0500 Subject: [PATCH 02/50] domains: support facebook comments --- plugins/domains/facebook.com/facebook.post.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/plugins/domains/facebook.com/facebook.post.js b/plugins/domains/facebook.com/facebook.post.js index 8e6fd3bfd..3968b1d00 100644 --- a/plugins/domains/facebook.com/facebook.post.js +++ b/plugins/domains/facebook.com/facebook.post.js @@ -11,7 +11,7 @@ module.exports = { /^https?:\/\/(?:www|m|business)\.facebook\.com\/media\/set\/\?set=[^\/]+(\d{10,})/i ], - getLink: function(oembed, options) { + getLink: function(url, oembed, options) { var width = options.maxWidth || options.getProviderOptions('facebook.width', DEFAULT_WIDTH); @@ -20,6 +20,13 @@ module.exports = { html = html.replace(/connect\.facebook\.net\/\w{2}_\w{2}\/sdk\.js/i, 'connect.facebook.net/' + options.getProviderOptions('locale', 'en_US') + '/sdk.js'); // FB gives it based on server IP, and it has inaccurate IP2Location + + if (/comment_id=\d+/i.test(url) && !/class=\"fb\-comment\-embed\"/.test(html)) { + // thank you FB for not working with comments + // https://developers.facebook.com/docs/plugins/embedded-comments + html = html.replace(/class=\"fb\-post\"/, 'class="fb-comment-embed" data-include-parent="' + (!options.getProviderOptions('facebook.exclude_comment_parent') ? 'true' : 'false') + '"'); + } + return { type: CONFIG.T.text_html, rel: [CONFIG.R.app, CONFIG.R.ssl, CONFIG.R.html5], @@ -33,6 +40,7 @@ module.exports = { "https://www.facebook.com/logvynenko/posts/10151487164961783", "https://www.facebook.com/chamvermeil/photos/a.398119066992522.1073741828.398102673660828/715129168624842/?type=1&theater", "https://www.facebook.com/photo.php?fbid=530060777048531&set=a.215094428545169.62692.100001338405848&type=1", + "https://www.facebook.com/zuck/posts/10102577175875681?comment_id=1193531464007751&reply_comment_id=654912701278942", { noFeeds: true } From 375604bf9019c84e1bcb13ae1a4a4caaf33bfa37 Mon Sep 17 00:00:00 2001 From: Ivan Paramonau Date: Thu, 22 Dec 2016 11:44:57 -0500 Subject: [PATCH 03/50] domains: support comments on FB videos --- .../domains/facebook.com/facebook.video.js | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/plugins/domains/facebook.com/facebook.video.js b/plugins/domains/facebook.com/facebook.video.js index 2cc114c6e..486ed8f4a 100644 --- a/plugins/domains/facebook.com/facebook.video.js +++ b/plugins/domains/facebook.com/facebook.video.js @@ -9,13 +9,27 @@ module.exports = { /^https?:\/\/(?:www|business)\.facebook\.com\/[a-zA-Z0-9.]+\/videos\/.+/i ], - getLink: function(oembed, options) { + getLink: function(url, oembed, options) { + + var html = oembed.html.replace(/connect\.facebook\.net\/\w{2}_\w{2}\/sdk\.js/i, + 'connect.facebook.net/' + options.getProviderOptions('locale', 'en_US') + '/sdk.js'); + + var rel = [CONFIG.R.ssl, CONFIG.R.html5]; + + if (/comment_id=\d+/i.test(url) && !/class=\"fb\-comment\-embed\"/.test(html)) { + // thank you FB for not working with comments + // https://developers.facebook.com/docs/plugins/embedded-comments + html = html.replace(/class=\"fb\-video\"/, 'class="fb-comment-embed" data-include-parent="' + (!options.getProviderOptions('facebook.exclude_comment_parent') ? 'true' : 'false') + '"'); + rel.push (CONFIG.R.app); + } else { + rel.plush (CONFIG.R.player); + } + return { type: CONFIG.T.text_html, - rel: [CONFIG.R.player, CONFIG.R.ssl, CONFIG.R.html5], - html: oembed.html.replace(/connect\.facebook\.net\/\w{2}_\w{2}\/sdk\.js/i, - 'connect.facebook.net/' + options.getProviderOptions('locale', 'en_US') + '/sdk.js'), + rel: rel, + html: html, "aspect-ratio": oembed.height ? oembed.width / oembed.height : 16/9 } }, @@ -27,6 +41,7 @@ module.exports = { "https://www.facebook.com/video.php?v=4392385966850", "https://www.facebook.com/joe.yu.94/videos/10206321173378788/", "https://business.facebook.com/KMPHFOX26/videos/10154356403004012/", + "https://www.facebook.com/tv2nyhederne/videos/1657445024271131/?comment_id=1657463030935997", { noFeeds: true } From bfd73b69f7f9f0712e2c6fe3b1331a07ba089155 Mon Sep 17 00:00:00 2001 From: Ivan Paramonau Date: Thu, 22 Dec 2016 12:34:40 -0500 Subject: [PATCH 04/50] fix typo --- plugins/domains/facebook.com/facebook.video.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/domains/facebook.com/facebook.video.js b/plugins/domains/facebook.com/facebook.video.js index 486ed8f4a..58bf5fa38 100644 --- a/plugins/domains/facebook.com/facebook.video.js +++ b/plugins/domains/facebook.com/facebook.video.js @@ -22,7 +22,7 @@ module.exports = { html = html.replace(/class=\"fb\-video\"/, 'class="fb-comment-embed" data-include-parent="' + (!options.getProviderOptions('facebook.exclude_comment_parent') ? 'true' : 'false') + '"'); rel.push (CONFIG.R.app); } else { - rel.plush (CONFIG.R.player); + rel.push (CONFIG.R.player); } From 2ad9686c9624c92583f0e3ff2b6f6b126256dcc2 Mon Sep 17 00:00:00 2001 From: Nazar Leush Date: Thu, 22 Dec 2016 21:04:11 +0200 Subject: [PATCH 05/50] [tester] bugfix --- modules/tests-ui/tester.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/tests-ui/tester.js b/modules/tests-ui/tester.js index f178ff06b..0a4d0e22f 100644 --- a/modules/tests-ui/tester.js +++ b/modules/tests-ui/tester.js @@ -335,7 +335,7 @@ function processPluginTests(pluginTest, plugin, count, cb) { // Error on unused mandatory methods. if (unusedMethods.mandatory.length > 0) { - logEntry.errors_list = logEntry.errors || []; + logEntry.errors_list = logEntry.errors_list || []; unusedMethods.mandatory.forEach(function(m) { var inError = _.find(errors, function(error) { return error.indexOf(m) > -1; From 1859f3321a92330423ccfe3ccf4caf1b3bdf0dca Mon Sep 17 00:00:00 2001 From: Nazar Leush Date: Fri, 23 Dec 2016 17:47:55 +0200 Subject: [PATCH 06/50] [oembed] fix undefined --- lib/plugins/system/oembed/oembedUtils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/plugins/system/oembed/oembedUtils.js b/lib/plugins/system/oembed/oembedUtils.js index 8cabcc932..58205fc51 100644 --- a/lib/plugins/system/oembed/oembedUtils.js +++ b/lib/plugins/system/oembed/oembedUtils.js @@ -197,7 +197,7 @@ module.exports.getOembed = function(uri, options, callback) { if (!error && data) { cache.set(oembed_key, data, { - ttl: options.cache_ttl + ttl: options && options.cache_ttl }); } From 6e739a74a6ab975b771c73e7affc7ee9d93478e5 Mon Sep 17 00:00:00 2001 From: Ivan Paramonau Date: Fri, 23 Dec 2016 11:13:19 -0500 Subject: [PATCH 07/50] domains: better libsyn episodes --- plugins/domains/libsyn.com.js | 38 +++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 plugins/domains/libsyn.com.js diff --git a/plugins/domains/libsyn.com.js b/plugins/domains/libsyn.com.js new file mode 100644 index 000000000..16c34d18f --- /dev/null +++ b/plugins/domains/libsyn.com.js @@ -0,0 +1,38 @@ +module.exports = { + + mixins: [ + "*" + ], + + getLink: function(twitter) { + + if (twitter.player && twitter.player.value && /^https?:\/\/html5\-player\.libsyn\.com\/embed\/episode\/id\/\d+/i.test(twitter.player.value)) { + + var href = twitter.player.value.match(/^https?:\/\/html5\-player\.libsyn\.com\/embed\/episode\/id\/\d+/i)[0]; + href += '/theme/custom/'; + + var player = { + href: href, + rel: [CONFIG.R.player, CONFIG.R.html5], + type: CONFIG.T.text_html, + }; + + if (twitter.stream && twitter.stream.value && /\.mp4$/i.test(twitter.stream.value)) { + player['aspect-ratio'] = 16/9; + player['padding-bottom'] = 90; + } else { + player.height = 90; + } + + return player; + } + }, + + tests: [ + "http://3manbreak.libsyn.com/10-build-a-bear-for-bradley-beal-december-1-of-3", + "http://directory.libsyn.com/episode/index/id/3252958", + // "http://mohrstories.libsyn.com/podcast/mor-stories-267-john-dimaggio", // broken + "http://mumiapodcast.libsyn.com/message-for-red-emmas-book-fair-saturday-9-26-2015-baltimore", + "http://3manbreak.libsyn.com/10-build-a-bear-for-bradley-beal-december-1-of-3" + ] +}; \ No newline at end of file From b42b21f48417d3d3bbc4270bb66426224310e7c8 Mon Sep 17 00:00:00 2001 From: Ivan Paramonau Date: Tue, 27 Dec 2016 18:21:57 -0500 Subject: [PATCH 08/50] domains: verify 404s for Droplr --- plugins/domains/d.pr.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/plugins/domains/d.pr.js b/plugins/domains/d.pr.js index 76bd0a3ca..235a20332 100644 --- a/plugins/domains/d.pr.js +++ b/plugins/domains/d.pr.js @@ -17,14 +17,16 @@ module.exports = { return { href: oembed.url, type: CONFIG.T.image, - rel: CONFIG.R.image, - width: oembed.width, - height: oembed.height + rel: CONFIG.R.image + // verify that image exists, omit sizes + // width: oembed.width, + // height: oembed.height }; } }, tests: [ - "http://d.pr/i/9jB7" + "http://d.pr/i/9jB7", + // "http://d.pr/i/vO1p" // 404 ] }; \ No newline at end of file From e4b9b07addc66a2ecf33b2f2e5a91607a36253fb Mon Sep 17 00:00:00 2001 From: Ivan Paramonau Date: Tue, 27 Dec 2016 18:22:26 -0500 Subject: [PATCH 09/50] domains: stop autoplay for twitch --- plugins/domains/twitch.tv.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/domains/twitch.tv.js b/plugins/domains/twitch.tv.js index d20fb7c5b..c8e0a8738 100644 --- a/plugins/domains/twitch.tv.js +++ b/plugins/domains/twitch.tv.js @@ -13,7 +13,7 @@ module.exports = { if (/^video/i.test(og.type)) { return !urlMatch[2] ? { - href: "//player.twitch.tv/?channel=" + urlMatch[1], + href: "//player.twitch.tv/?channel=" + urlMatch[1]+"&autoplay=false", type: CONFIG.T.text_html, rel: [CONFIG.R.player, CONFIG.R.html5], "aspect-ratio": 16 /9 @@ -28,6 +28,7 @@ module.exports = { tests: [ "https://www.twitch.tv/imaqtpie", - "http://www.twitch.tv/adultswim" + "http://www.twitch.tv/adultswim", + "https://www.twitch.tv/xleinonen" ] }; \ No newline at end of file From 87ff875ba9eb5ed2d5311b513dc5b9f6334772ea Mon Sep 17 00:00:00 2001 From: Ivan Paramonau Date: Tue, 27 Dec 2016 18:22:42 -0500 Subject: [PATCH 10/50] domains: cbsnews is not available --- plugins/{domains => .fixme}/cbsnews.com.js | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename plugins/{domains => .fixme}/cbsnews.com.js (100%) diff --git a/plugins/domains/cbsnews.com.js b/plugins/.fixme/cbsnews.com.js similarity index 100% rename from plugins/domains/cbsnews.com.js rename to plugins/.fixme/cbsnews.com.js From 485a8763ba6d0e34668b9d5249f8108723a6e93b Mon Sep 17 00:00:00 2001 From: Ivan Paramonau Date: Thu, 29 Dec 2016 13:17:38 -0500 Subject: [PATCH 11/50] domains: globeandmail plugin no longer needed --- plugins/{domains => .fixme}/theglobeandmail.com/globe.video.js | 0 plugins/domains/datawrapper.de.js | 3 ++- plugins/domains/knightlab.js | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) rename plugins/{domains => .fixme}/theglobeandmail.com/globe.video.js (100%) diff --git a/plugins/domains/theglobeandmail.com/globe.video.js b/plugins/.fixme/theglobeandmail.com/globe.video.js similarity index 100% rename from plugins/domains/theglobeandmail.com/globe.video.js rename to plugins/.fixme/theglobeandmail.com/globe.video.js diff --git a/plugins/domains/datawrapper.de.js b/plugins/domains/datawrapper.de.js index 228d7bb30..14ae7f919 100644 --- a/plugins/domains/datawrapper.de.js +++ b/plugins/domains/datawrapper.de.js @@ -26,6 +26,7 @@ module.exports = { "http://datawrapper.dwcdn.net/zjCKi/2/", "http://cf.datawrapper.de/zjCKi/2/", "http://cf.datawrapper.de/Gx44C/21/", - "http://cf.datawrapper.de/RrO5t/2/" + "http://cf.datawrapper.de/RrO5t/2/", + "http://datawrapper.dwcdn.net/pKk9h/1/" ] }; diff --git a/plugins/domains/knightlab.js b/plugins/domains/knightlab.js index efd9152fe..5f1666464 100644 --- a/plugins/domains/knightlab.js +++ b/plugins/domains/knightlab.js @@ -23,6 +23,6 @@ module.exports = { "https://s3.amazonaws.com/uploads.knightlab.com/storymapjs/86a5b5c6facef8e74eb685573b846f6b/civilian-deaths-evidence-of-war-crimes-in-yemen/index.html", "https://cdn.knightlab.com/libs/juxtapose/latest/embed/index.html?uid=f9031656-dcc3-11e5-a524-0e7075bba956", "http://cdn.knightlab.com/libs/juxtapose/dev/embed/index.html?uid=75ec66e0-204a-11e5-91b9-0e7075bba956", - "http://cdn.knightlab.com/libs/timeline/latest/embed/index.html?source=0Atwxho6G5yhjdEdJNU1JMzhLdjdHUTFMNnc4bHNud3c&font=PTSerif-PTSans&maptype=toner&lang=en&hash_bookmark=true&start_zoom_adjust=2&height=650#13", + "http://cdn.knightlab.com/libs/timeline/latest/embed/index.html?source=0Atwxho6G5yhjdEdJNU1JMzhLdjdHUTFMNnc4bHNud3c&font=PTSerif-PTSans&maptype=toner&lang=en&hash_bookmark=true&start_zoom_adjust=2&height=650#13" ] }; \ No newline at end of file From 3a36f1142b4012facb3b669a75ab532339e58675 Mon Sep 17 00:00:00 2001 From: Ivan Paramonau Date: Thu, 29 Dec 2016 13:33:17 -0500 Subject: [PATCH 12/50] generic: allow parsely-metadata --- ...ely-page-image_url.js => parsely-image.js} | 4 +-- plugins/meta/parsely.js | 35 +++++++++++++++++++ plugins/meta/parsely_page.js | 34 ------------------ 3 files changed, 37 insertions(+), 36 deletions(-) rename plugins/links/{parsely-page-image_url.js => parsely-image.js} (60%) create mode 100644 plugins/meta/parsely.js delete mode 100644 plugins/meta/parsely_page.js diff --git a/plugins/links/parsely-page-image_url.js b/plugins/links/parsely-image.js similarity index 60% rename from plugins/links/parsely-page-image_url.js rename to plugins/links/parsely-image.js index 99a179819..52ef44453 100644 --- a/plugins/links/parsely-page-image_url.js +++ b/plugins/links/parsely-image.js @@ -1,8 +1,8 @@ module.exports = { - getLink: function(parsely_page) { + getLink: function(parsely) { return { - href: parsely_page.image_url, + href: parsely.image_url, type: CONFIG.T.image, rel: CONFIG.R.thumbnail }; diff --git a/plugins/meta/parsely.js b/plugins/meta/parsely.js new file mode 100644 index 000000000..3e7e7a8ce --- /dev/null +++ b/plugins/meta/parsely.js @@ -0,0 +1,35 @@ +module.exports = { + + highestPriority: true, + + provides: 'self', + + getData: function(meta) { + + var p = meta["parsely-page"] || meta["parsely-metadata"]; + if (p) { + try { + + var data = JSON.parse(p); + + return { + parsely: data + }; + + } catch(ex) { + } + } + }, + + getMeta: function(parsely) { + + return { + title: parsely.title, + date: parsely.pub_date, + description: parsely.summary, + author: parsely.author, + keywords: parsely.tags && parsely.tags instanceof Array ? parsely.tags.join(', ') : null, + category: parsely.section + }; + } +}; \ No newline at end of file diff --git a/plugins/meta/parsely_page.js b/plugins/meta/parsely_page.js deleted file mode 100644 index dc0268449..000000000 --- a/plugins/meta/parsely_page.js +++ /dev/null @@ -1,34 +0,0 @@ -module.exports = { - - highestPriority: true, - - provides: 'self', - - getData: function(meta) { - - var p = meta["parsely-page"]; - if (p) { - try { - - var data = JSON.parse(p); - - return { - parsely_page: data - }; - - } catch(ex) { - } - } - }, - - getMeta: function(parsely_page) { - - return { - title: parsely_page.title, - date: parsely_page.pub_date, - author: parsely_page.author, - keywords: parsely_page.tags && parsely_page.tags instanceof Array ? parsely_page.tags.join(', ') : null, - category: parsely_page.section - }; - } -}; \ No newline at end of file From cb64e924d6edd9c60ac7764fd060e4f842d9856c Mon Sep 17 00:00:00 2001 From: Ivan Paramonau Date: Thu, 29 Dec 2016 13:44:22 -0500 Subject: [PATCH 13/50] domains: avoid galleries conflict --- lib/plugins/system/oembed/providers.json | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/plugins/system/oembed/providers.json b/lib/plugins/system/oembed/providers.json index 0038f0ad8..c139f1e75 100644 --- a/lib/plugins/system/oembed/providers.json +++ b/lib/plugins/system/oembed/providers.json @@ -375,6 +375,14 @@ ], "endpoint": "http://api.meetup.com/oembed" }, + { + "name": "DeviantArt", + "templates": [ + ".*\\.deviantart\\.com/art/.*", + ".*\\.deviantart\\.com/gallery/.*" + ], + "endpoint": "http://backend.deviantart.com/oembed" + }, { "name": "Behance", "templates": [ @@ -434,13 +442,6 @@ ], "endpoint": "https://www.tumblr.com/oembed/1.0" }, - { - "name": "DeviantArt", - "templates": [ - ".*\\.deviantart\\.com/art/.*" - ], - "endpoint": "http://backend.deviantart.com/oembed" - }, { "name": "roomshare.jp", "templates": [ From fd8214267b520ea7b90ec2725018991753c37db4 Mon Sep 17 00:00:00 2001 From: Ivan Paramonau Date: Thu, 29 Dec 2016 13:58:41 -0500 Subject: [PATCH 14/50] domains: a bit better regex for iTunes albums --- plugins/domains/itunes.apple.com/apple.music.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/domains/itunes.apple.com/apple.music.js b/plugins/domains/itunes.apple.com/apple.music.js index eb8196a56..4e4ba1f9a 100644 --- a/plugins/domains/itunes.apple.com/apple.music.js +++ b/plugins/domains/itunes.apple.com/apple.music.js @@ -3,7 +3,8 @@ module.exports = { re: [ /^https?:\/\/(?:geo\.)?itunes\.apple\.com\/(\w{2})\/(album)(?:\/[^\/]+)?\/id(\d+)\?i=(\d+)?/i, /^https?:\/\/(?:geo\.)?itunes\.apple\.com\/(\w{2})\/(album|playlist)(?:\/[^\/]+)?\/id(?:pl\.)?(\d+)/i, - /^https?:\/\/(?:geo\.)?itunes\.apple\.com\/()(album)\/id(\d+)\?/i + /^https?:\/\/(?:geo\.)?itunes\.apple\.com\/()(album)\/id(\d+)\??/i + ], mixins: [ @@ -33,6 +34,7 @@ module.exports = { 'https://itunes.apple.com/us/album/12-12-12-concert-for-sandy/id585701590?v0=WWW-NAUS-ITSTOP100-ALBUMS&ign-mpt=uo%3D4', 'https://itunes.apple.com/us/album/id944094900?i&ls=1', 'https://itunes.apple.com/album/id1170687816?ls=1', + "https://itunes.apple.com/album/id1125277620", 'https://geo.itunes.apple.com/us/album/trap-or-die-3/id1163301872?app=music', 'https://geo.itunes.apple.com/us/album/fake-love/id1168503200?i=1168503281&mt=1&app=music', 'https://itunes.apple.com/ca/album/greatest-feat.-kendrick-lamar/id1149503804?i=1149503816&app=music&ign-mpt=uo%3D4', From 7676e259fe2010a04dc10b4b3a1099b341e99823 Mon Sep 17 00:00:00 2001 From: Ivan Paramonau Date: Mon, 2 Jan 2017 12:22:08 -0500 Subject: [PATCH 15/50] youtube: add canonical and author_url fixes #147 #148 --- plugins/domains/youtube.com/youtube.video.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/domains/youtube.com/youtube.video.js b/plugins/domains/youtube.com/youtube.video.js index 64a659cc6..094c32ad6 100644 --- a/plugins/domains/youtube.com/youtube.video.js +++ b/plugins/domains/youtube.com/youtube.video.js @@ -113,7 +113,11 @@ module.exports = { dislikes: youtube_video_gdata.dislikeCount, views: youtube_video_gdata.viewCount, media: 'player', - site: "YouTube" + site: "YouTube", + canonical: "https://www.youtube.com/watch?v=" + youtube_video_gdata.id, + author_url: "https://www.youtube.com/user/" + youtube_video_gdata.uploader + + }; }, From 5d20371b6118c8844c9b66f8f7bf3ca1260c227c Mon Sep 17 00:00:00 2001 From: Ivan Paramonau Date: Mon, 2 Jan 2017 13:11:44 -0500 Subject: [PATCH 16/50] youtube: proper author_url for channels --- plugins/domains/youtube.com/youtube.video.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/plugins/domains/youtube.com/youtube.video.js b/plugins/domains/youtube.com/youtube.video.js index 094c32ad6..55a38cb50 100644 --- a/plugins/domains/youtube.com/youtube.video.js +++ b/plugins/domains/youtube.com/youtube.video.js @@ -62,6 +62,7 @@ module.exports = { title: entry.snippet && entry.snippet.title, uploaded: entry.snippet && entry.snippet.publishedAt, uploader: entry.snippet && entry.snippet.channelTitle, + channelId: entry.snippet && entry.snippet.channelId, description: entry.snippet && entry.snippet.description, likeCount: entry.statistics && entry.statistics.likeCount, dislikeCount: entry.statistics && entry.statistics.dislikeCount, @@ -115,9 +116,7 @@ module.exports = { media: 'player', site: "YouTube", canonical: "https://www.youtube.com/watch?v=" + youtube_video_gdata.id, - author_url: "https://www.youtube.com/user/" + youtube_video_gdata.uploader - - + author_url: "https://www.youtube.com/" + (youtube_video_gdata.channelId ? "channel/" + youtube_video_gdata.channelId : "user/" + youtube_video_gdata.uploader) }; }, From 9bc62fe0efaffa6b9594569077d49b319de9de54 Mon Sep 17 00:00:00 2001 From: Nazar Leush Date: Mon, 2 Jan 2017 20:25:53 +0200 Subject: [PATCH 17/50] [meta] better parsely processing --- plugins/meta/parsely.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/plugins/meta/parsely.js b/plugins/meta/parsely.js index 3e7e7a8ce..e32682743 100644 --- a/plugins/meta/parsely.js +++ b/plugins/meta/parsely.js @@ -8,6 +8,7 @@ module.exports = { var p = meta["parsely-page"] || meta["parsely-metadata"]; if (p) { + try { var data = JSON.parse(p); @@ -18,6 +19,21 @@ module.exports = { } catch(ex) { } + + } else if (meta["parsely-title"]) { + + var key, data = {}; + + for(key in meta) { + if (key.indexOf('parsely-') === 0) { + var p_key = key.substring(8); + data[p_key] = meta[key]; + } + } + + return { + parsely: data + }; } }, @@ -25,7 +41,7 @@ module.exports = { return { title: parsely.title, - date: parsely.pub_date, + date: parsely.pub_date || parsely["pub-date"], description: parsely.summary, author: parsely.author, keywords: parsely.tags && parsely.tags instanceof Array ? parsely.tags.join(', ') : null, From 1841d235e25c3f290b3aabfb254c877a35ff7738 Mon Sep 17 00:00:00 2001 From: Ivan Paramonau Date: Mon, 2 Jan 2017 13:29:49 -0500 Subject: [PATCH 18/50] domains: new direct links to gfycat media --- plugins/domains/i.gfycat.com.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/domains/i.gfycat.com.js b/plugins/domains/i.gfycat.com.js index 11116198c..24fa38f4d 100644 --- a/plugins/domains/i.gfycat.com.js +++ b/plugins/domains/i.gfycat.com.js @@ -1,7 +1,7 @@ module.exports = { re: [ - /https?:\/\/(?:giant|thumbs|zippy)\.gfycat\.com\/([a-zA-Z0-9]+)(?:\-mobile)?\.(?:webm|mp4|gif)$/i, + /https?:\/\/(?:giant|thumbs|zippy)\.gfycat\.com\/([a-zA-Z0-9]+)(?:\-mobile|\-size_restricted)?\.(?:webm|mp4|gif)$/i, /https?:\/\/gfycat\.com\/(?:detail|ifr)\/([a-zA-Z0-9]+)$/i ], @@ -20,6 +20,7 @@ module.exports = { "https://thumbs.gfycat.com/ObviousEuphoricHadrosaurus-mobile.mp4", "https://gfycat.com/detail/ImmaculateWastefulCanine", "https://zippy.gfycat.com/YellowHelplessDikdik.webm", - "https://gfycat.com/ifr/EvergreenAbsoluteAracari" + "https://gfycat.com/ifr/EvergreenAbsoluteAracari", + "https://thumbs.gfycat.com/IdealFluffyBabirusa-size_restricted.gif" ] }; \ No newline at end of file From 89edd9bdbe1ed1d4834eccdd20bf09d6ea21e8dd Mon Sep 17 00:00:00 2001 From: Ivan Paramonau Date: Tue, 3 Jan 2017 11:06:26 -0500 Subject: [PATCH 19/50] general: get some meta from ya-ovs --- plugins/meta/yandex-ovs.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 plugins/meta/yandex-ovs.js diff --git a/plugins/meta/yandex-ovs.js b/plugins/meta/yandex-ovs.js new file mode 100644 index 000000000..855c883ef --- /dev/null +++ b/plugins/meta/yandex-ovs.js @@ -0,0 +1,22 @@ +module.exports = { + + provides: 'ovs', + + getMeta: function(ovs) { + + return { + date: ovs.upload_date, + views: ovs.views_total + } + + }, + + getData: function(meta) { + + if (meta.ya && meta.ya.ovs) { + return { + ovs: meta.ya.ovs + } + } + } +}; \ No newline at end of file From 29a8eb20bf76a2076b885c439b870c8e133c70af Mon Sep 17 00:00:00 2001 From: Nazar Leush Date: Tue, 3 Jan 2017 19:02:09 +0200 Subject: [PATCH 20/50] [meta] unify oembed product currency_code to currency --- docs/META.md | 2 +- plugins/meta/oembed-product.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/META.md b/docs/META.md index fb89c00a7..623ffcd17 100644 --- a/docs/META.md +++ b/docs/META.md @@ -62,7 +62,7 @@ Following Open Graph spec: Following Pinterest spec: - `price` -- `currency_code` +- `currency` - `brand` - `product_id` - `availability` diff --git a/plugins/meta/oembed-product.js b/plugins/meta/oembed-product.js index 45a7a5cd8..02b328633 100644 --- a/plugins/meta/oembed-product.js +++ b/plugins/meta/oembed-product.js @@ -5,7 +5,7 @@ module.exports = { if (oembed.type == "product") { return { price: oembed.price && parseFloat(oembed.price), - currency_code: oembed.currency_code, + currency: oembed.currency_code, brand: oembed.brand, product_id: oembed.product_id, availability: oembed.availability, From 2bb75e22d94c69e46587fce1dfdfe7fb4f41213b Mon Sep 17 00:00:00 2001 From: Ivan Paramonau Date: Tue, 3 Jan 2017 12:07:49 -0500 Subject: [PATCH 21/50] general: better media detector for video subdomains --- plugins/meta/media-detector.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/meta/media-detector.js b/plugins/meta/media-detector.js index b04cdae12..e59744560 100644 --- a/plugins/meta/media-detector.js +++ b/plugins/meta/media-detector.js @@ -18,7 +18,7 @@ module.exports = { if (meta.og) { - if ((meta.og.video && !meta.og.type )|| (meta.og.type && typeof meta.og.type === 'string' && meta.og.type.match(/video|movie/i)) || /\/videos?\//i.test(url)) { + if ((meta.og.video && !meta.og.type ) || (meta.og.type && typeof meta.og.type === 'string' && meta.og.type.match(/video|movie/i)) || /\/videos?\//i.test(url) || /https?:\/\/videos?\./i.test(url)) { has_player = true; } From 4487d9e158f71792318d9782f0b5a49c27c6117a Mon Sep 17 00:00:00 2001 From: Ivan Paramonau Date: Wed, 4 Jan 2017 19:37:10 -0500 Subject: [PATCH 22/50] meta: get og.updated_time --- plugins/meta/og-date.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/meta/og-date.js b/plugins/meta/og-date.js index 5f3f3ead8..0b88c67e7 100644 --- a/plugins/meta/og-date.js +++ b/plugins/meta/og-date.js @@ -9,7 +9,11 @@ module.exports = { } else if (og.video) { return { date: og.video.release_date - }; + }; + } else if (og.updated_time) { + return { + date: og.updated_time + }; } } }; \ No newline at end of file From c332ecc6b8274e8c2e8519ff0a47a4dad820c887 Mon Sep 17 00:00:00 2001 From: Ivan Paramonau Date: Wed, 4 Jan 2017 21:11:36 -0500 Subject: [PATCH 23/50] meta: better extract prices from twitter and embed --- plugins/meta/oembed-product.js | 7 +++++++ plugins/meta/twitter-labels.js | 31 +++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 plugins/meta/twitter-labels.js diff --git a/plugins/meta/oembed-product.js b/plugins/meta/oembed-product.js index 02b328633..a0e1db4c8 100644 --- a/plugins/meta/oembed-product.js +++ b/plugins/meta/oembed-product.js @@ -12,6 +12,13 @@ module.exports = { quantity: oembed.quantity && parseInt(oembed.quantity), offers: oembed.offers }; + } else if (oembed.price) { // non-shopify products, per pinterest spec + + return { + price: oembed.price && parseFloat(oembed.price), + currency: oembed.currency_code || oembed.currency, + availability: oembed.availability + } } } }; diff --git a/plugins/meta/twitter-labels.js b/plugins/meta/twitter-labels.js new file mode 100644 index 000000000..79bfecbb7 --- /dev/null +++ b/plugins/meta/twitter-labels.js @@ -0,0 +1,31 @@ +module.exports = { + + lowestPriority: true, + + getMeta: function(twitter) { + + if (twitter["label1"] && twitter["data1"]) { + + var i = 1, j= 1, labels = {}; + + while (twitter["label"+i] && twitter["data"+i]) { + + if (twitter["label"+i].match(/^price$/i)) { + labels.price = twitter["data"+i]; + } else if (twitter["label"+i].match(/^USD|EUR|GBP|CAD|JPY|AUD$/i)) { + labels.price = twitter["data"+i]; + labels.currency = twitter["label"+i]; + } else if (twitter["label"+i].match(/^currency$/i)) { + labels.currency = twitter["data"+i]; + } else { + labels["label" + j + "-" + twitter["label"+i]] = twitter["data"+i]; + j++; + } + + i++; + } + + return labels; + } + } +}; \ No newline at end of file From 15e5d4e42daa8bd09feba736fc7d98af1b6a5ce6 Mon Sep 17 00:00:00 2001 From: Nazar Leush Date: Thu, 5 Jan 2017 15:28:52 +0200 Subject: [PATCH 24/50] [utils] fix processing date (if it is array) --- lib/utils.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/utils.js b/lib/utils.js index 21dba3365..c177e40c4 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -452,6 +452,10 @@ var NOW = new Date().getTime(); exports.unifyDate = function(date) { + if (_.isArray(date)) { + date = date[0]; + } + if (typeof date === "string" && date.match(/^\d+$/)) { date = parseInt(date); } @@ -473,8 +477,8 @@ exports.unifyDate = function(date) { // TODO: time in format 'Mon, 29 October 2012 18:15:00' parsed as local timezone anyway. var timestamp = Date.parse(date); - if (isNaN(timestamp)) { - // allow Z at the end which Node doesn't seem to parse into timestamp otherwise + if (isNaN(timestamp) && date.replace) { + // allow Z at the end which Node doesn't seem to parse into timestamp otherwise timestamp = Date.parse(date.replace(/Z$/, '')); } From bf56e3dca89858c9f6fe21c2f82ce1a5005074bd Mon Sep 17 00:00:00 2001 From: Ivan Paramonau Date: Thu, 5 Jan 2017 12:33:33 -0500 Subject: [PATCH 25/50] domains: responsive bet.com videos --- plugins/domains/bet.com.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 plugins/domains/bet.com.js diff --git a/plugins/domains/bet.com.js b/plugins/domains/bet.com.js new file mode 100644 index 000000000..d168ee46e --- /dev/null +++ b/plugins/domains/bet.com.js @@ -0,0 +1,26 @@ +module.exports = { + + re: /^https?:\/\/(?:www\.)?bet\.com\/videos?\//i, + + mixins: [ + "*" + ], + + getLink: function(og) { + + if (og.video && og.video.url) { + + return { + href: og.video.url.replace(/\.share\.height\-\d+\.width\-\d+\.html$/, '.share.responsive-true.html'), + rel: [CONFIG.R.player, CONFIG.R.html5, CONFIG.R.autoplay], + type: CONFIG.T.text_html, + "aspect-ratio": 16/9 + } + } + }, + + tests: [ + "http://www.bet.com/video/hiphopawards/2016/cyphers/kur-dave-east-young-m-a-sam-black-ms-jade.html", + "http://www.bet.com/video/106andpark/highlights/mack-wilds-106-and-park-3449.html" + ] +}; \ No newline at end of file From 5d6c12e0df44b5a881a97e4cf83bf2189b328197 Mon Sep 17 00:00:00 2001 From: Ivan Paramonau Date: Thu, 5 Jan 2017 13:37:05 -0500 Subject: [PATCH 26/50] domains: better rels for youku --- plugins/domains/youku.com.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/plugins/domains/youku.com.js b/plugins/domains/youku.com.js index 1c33ad4d3..eceeee699 100644 --- a/plugins/domains/youku.com.js +++ b/plugins/domains/youku.com.js @@ -10,12 +10,17 @@ module.exports = { getLink: function (urlMatch) { - return { - href: "http://player.youku.com/embed/"+ urlMatch[1], + return [{ + href: "//player.youku.com/embed/"+ urlMatch[1], type: CONFIG.T.text_html, - rel: CONFIG.R.player, + rel: [CONFIG.R.player, CONFIG.R.html5], "aspect-ratio": 16/10 //As stated it in docs - } + }, { + href: "//player.youku.com/embed/"+ urlMatch[1] + "?autoplay=true", + type: CONFIG.T.text_html, + rel: [CONFIG.R.player, CONFIG.R.html5, CONFIG.R.autoplay], + "aspect-ratio": 16/10 //As stated it in docs + }] }, tests: [{ From 8cb5116ce10087830525f04afedf614125bfb3a6 Mon Sep 17 00:00:00 2001 From: Ivan Paramonau Date: Fri, 6 Jan 2017 09:02:50 -0500 Subject: [PATCH 27/50] domains: add oembed discovery for ReverbNation songs --- lib/plugins/system/oembed/providers.json | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/plugins/system/oembed/providers.json b/lib/plugins/system/oembed/providers.json index c139f1e75..c279c3e27 100644 --- a/lib/plugins/system/oembed/providers.json +++ b/lib/plugins/system/oembed/providers.json @@ -544,6 +544,13 @@ "templates": [ "gty.im" ], - "endpoint": "http://embed.gettyimages.com//oembed" - } + "endpoint": "http://embed.gettyimages.com/oembed" + }, + { + "name": "ReverbNation", + "templates": [ + "reverbnation.com" + ], + "endpoint": "https://www.reverbnation.com/oembed" + } ] \ No newline at end of file From 900aea047b4278b195c88ce61a1697cb90ad8375 Mon Sep 17 00:00:00 2001 From: Ivan Paramonau Date: Sun, 8 Jan 2017 19:34:33 -0500 Subject: [PATCH 28/50] domains: keep up USA Today coverage --- plugins/domains/usatoday.com.js | 9 ++++++--- plugins/links/mobile-canonical.js | 3 ++- plugins/meta/video-duration.js | 4 ++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/plugins/domains/usatoday.com.js b/plugins/domains/usatoday.com.js index 5b857d082..eebc36259 100644 --- a/plugins/domains/usatoday.com.js +++ b/plugins/domains/usatoday.com.js @@ -1,8 +1,9 @@ module.exports = { re: [ - /^https?:\/\/www\.(\w+)\.com\/media\/cinematic\/video\/(\d{7,9})\/[a-zA-Z0-9\-\_]+\/?$/i, - /^https?:\/\/www\.(\w+)\.com\/videos\/\w+\/(?:[a-z0-9\/]+)?\d{4}\/\d{2}\/\d{2}\/(\d{7,9})\/?$/i + /^https?:\/\/www\.(\w+)\.com\/media\/cinematic\/video\/(\d{7,9})\/[a-zA-Z0-9\-\_:\.]+\/?$/i, + /^https?:\/\/www\.(\w+)\.com\/videos\/\w+\/(?:[a-z0-9\/]+)?\d{4}\/\d{2}\/\d{2}\/(\d{7,9})\/?$/i, + /^https?:\/\/www\.(\w+)\.com\/videos\/\w+\/(?:[a-z0-9\/]+)?\d{4}\/\d{2}\/\d{2}\/[a-zA-Z0-9\-\_\.:]+\/(\d{7,9})\/?$/i ], provides: "gannettVideo", @@ -40,6 +41,8 @@ module.exports = { "http://www.usatoday.com/videos/news/humankind/2016/09/20/90730062/", "http://www.desertsun.com/media/cinematic/video/92390930/police-chief-quit-ignoring-red-flags/", "http://www.usatoday.com/videos/life/2016/11/09/93525560/", - "http://www.usatoday.com/videos/news/politics/elections/2016/2016/11/09/93532206/" + "http://www.usatoday.com/videos/news/politics/elections/2016/2016/11/09/93532206/", + "http://www.usatoday.com/videos/sports/2016/12/20/behind-scenes:-michael-phelps-cover-shoot/95645660/", + "http://www.usatoday.com/videos/news/2017/01/07/what-know-ft.-lauderdale-airport-shooter/96291014/" ] }; \ No newline at end of file diff --git a/plugins/links/mobile-canonical.js b/plugins/links/mobile-canonical.js index 0086b2205..d21c15deb 100644 --- a/plugins/links/mobile-canonical.js +++ b/plugins/links/mobile-canonical.js @@ -5,7 +5,8 @@ module.exports = { var canonical = (meta.canonical && meta.canonical.href) || meta.canonical || (meta.og && meta.og.url); // Redirect to canonical from mobile url. - if (canonical && url !== canonical && url.match(/^https?:\/\/(m|mobile)\./i)) { + if (canonical && url !== canonical + && (url.match(/^https?:\/\/(m|mobile)\./i) || url.match(/(\.|\/)amp(\.|\/)/i))) { // Do not redirect to url from redirects history. if (!options.redirectsHistory || options.redirectsHistory.indexOf(canonical) === -1) { diff --git a/plugins/meta/video-duration.js b/plugins/meta/video-duration.js index 184bfaa3b..6974a47a0 100644 --- a/plugins/meta/video-duration.js +++ b/plugins/meta/video-duration.js @@ -2,12 +2,12 @@ module.exports = { getMeta: function(meta) { - if (!meta.video) { + if (!meta.video && !meta.duration) { return; } return { - duration: meta.video.duration + duration: meta.video && meta.video.duration || meta.duration }; } }; \ No newline at end of file From 474c2f772dc463fd0cc6bb4b3f229c1a06b2d467 Mon Sep 17 00:00:00 2001 From: Ivan Paramonau Date: Sun, 8 Jan 2017 20:34:24 -0500 Subject: [PATCH 29/50] domains: data wrapper is now well covered by generic --- plugins/{domains => .noneed}/datawrapper.de.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename plugins/{domains => .noneed}/datawrapper.de.js (94%) diff --git a/plugins/domains/datawrapper.de.js b/plugins/.noneed/datawrapper.de.js similarity index 94% rename from plugins/domains/datawrapper.de.js rename to plugins/.noneed/datawrapper.de.js index 14ae7f919..322fff297 100644 --- a/plugins/domains/datawrapper.de.js +++ b/plugins/.noneed/datawrapper.de.js @@ -7,7 +7,7 @@ module.exports = { "*" ], - getLink: function(urlMatch) { + getLink: function(urlMatch, oembed) { return { type: CONFIG.T.text_html, rel: [CONFIG.R.app, CONFIG.R.ssl, CONFIG.R.html5], From 7f4ee2efa3c842b73bc4d8cc17e1eeb06c3cba85 Mon Sep 17 00:00:00 2001 From: Ivan Paramonau Date: Sun, 8 Jan 2017 21:17:40 -0500 Subject: [PATCH 30/50] domains: support a little more of Tableu --- .../public.tableau.com/tableau.shared.com.js | 19 ++++++++++++++++--- .../public.tableau.com/tableau.views.js | 4 +++- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/plugins/domains/public.tableau.com/tableau.shared.com.js b/plugins/domains/public.tableau.com/tableau.shared.com.js index 1d6f1a03d..10657ad91 100644 --- a/plugins/domains/public.tableau.com/tableau.shared.com.js +++ b/plugins/domains/public.tableau.com/tableau.shared.com.js @@ -1,15 +1,15 @@ module.exports = { - re: /^https?:\/\/public\.tableau\.com\/shared\/[a-zA-Z0-9_]+/i, + re: /^https?:\/\/public\.tableau\.com\/shared\/([a-zA-Z0-9_]+)/i, getLink: function(og, cb) { if (og.image && /^https?:\/\/public\.tableau\.com\/thumb\/views\/([^\/]+)\/([^\/\?#]+)/i.test(og.image || og.image.src)) { - var urlMatch = (og.image || og.image.src).match(/^https?:\/\/public\.tableau\.com\/thumb\/views\/([^\/]+)\/([^\/\?#]+)/i); + var imgMatch = (og.image || og.image.src).match(/^https?:\/\/public\.tableau\.com\/thumb\/views\/([^\/]+)\/([^\/\?#]+)/i); cb ({ - redirect: 'http://public.tableau.com/views/' + urlMatch[1] + '/' + urlMatch[2] + redirect: 'http://public.tableau.com/views/' + imgMatch[1] + '/' + imgMatch[2] }); } else { @@ -17,6 +17,19 @@ module.exports = { } }, + getData: function(urlMatch, options, cb) { + + if (!options.redirectsHistory) { + + cb ({ + redirect: 'https://public.tableau.com/shared/' + urlMatch[1] + '?:embed=y&:showVizHome=no' + }); + + } else { + cb(null); + } + }, + tests: [{ noFeeds: true }] diff --git a/plugins/domains/public.tableau.com/tableau.views.js b/plugins/domains/public.tableau.com/tableau.views.js index 3b84c14c2..0065fd186 100644 --- a/plugins/domains/public.tableau.com/tableau.views.js +++ b/plugins/domains/public.tableau.com/tableau.views.js @@ -93,6 +93,8 @@ module.exports = { "http://public.tableau.com/shared/7P2SM3PQG?:display_count=no", // not responsive: "http://public.tableau.com/views/HEROremodel/Dashboard1", - "http://public.tableau.com/shared/X7RMWXZYQ?:display_count=yes" + "http://public.tableau.com/shared/X7RMWXZYQ?:display_count=yes", + "https://public.tableau.com/shared/7SRD23PNF?:embed=y&:showVizHome=no&:display_static_image=y&:bootstrapWhenNotified=true", + "https://public.tableau.com/shared/NHR6XWHDQ?:display_count=yes" ] }; \ No newline at end of file From 690767d5de1c01bc3c23dd809799cbe526ccd895 Mon Sep 17 00:00:00 2001 From: Ivan Paramonau Date: Fri, 6 Jan 2017 13:38:33 -0500 Subject: [PATCH 31/50] general: option to rotate og video (sic) --- plugins/links/og-video.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/plugins/links/og-video.js b/plugins/links/og-video.js index 8746db2dc..0ed2495cb 100644 --- a/plugins/links/og-video.js +++ b/plugins/links/og-video.js @@ -3,12 +3,15 @@ var utils = require('./utils'); function getVideoLinks(video, whitelistRecord) { + var width = whitelistRecord.isAllowed('og.video', 'rotate') ? video.height : video.width; + var height = whitelistRecord.isAllowed('og.video', 'rotate') ? video.width : video.height; + var players = [{ href: video.url || video, type: CONFIG.T.maybe_text_html, rel: [CONFIG.R.player, CONFIG.R.og], - width: video.width, - height: video.height + width: width, + height: height }]; if (whitelistRecord.isAllowed('og.video', 'ssl') && video.secure_url) { @@ -16,8 +19,8 @@ function getVideoLinks(video, whitelistRecord) { href: video.secure_url, type: CONFIG.T.maybe_text_html, rel: [CONFIG.R.player, CONFIG.R.og], - width: video.width, - height: video.height + width: width, + height: height }); } @@ -26,8 +29,8 @@ function getVideoLinks(video, whitelistRecord) { href: video.iframe, type: CONFIG.T.maybe_text_html, rel: [CONFIG.R.player, CONFIG.R.og], - width: video.width, - height: video.height + width: width, + height: height }); } From 7080cd2b256ae7c81e4c4438c3f463f3c9c2dc7d Mon Sep 17 00:00:00 2001 From: Ivan Paramonau Date: Fri, 6 Jan 2017 13:56:54 -0500 Subject: [PATCH 32/50] general: handle horizontal twitter-players --- plugins/links/twitter-player.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/plugins/links/twitter-player.js b/plugins/links/twitter-player.js index d647584d3..665d43b64 100644 --- a/plugins/links/twitter-player.js +++ b/plugins/links/twitter-player.js @@ -6,13 +6,18 @@ module.exports = { var type = whitelistRecord.isAllowed('twitter.player', 'html5') ? CONFIG.T.text_html : CONFIG.T.maybe_text_html; - return { + var player = { href: twitter.player.value || twitter.player, type: type, rel: [CONFIG.R.player, CONFIG.R.twitter], - width: twitter.player.width, height: twitter.player.height }; + + if (!whitelistRecord.isAllowed('twitter.player', 'horizontal')) { + player.width = twitter.player.width; + } + + return player; } } }; \ No newline at end of file From 5368c1a9d4bc7825b0aa4799eb192ca46596a5da Mon Sep 17 00:00:00 2001 From: Ivan Paramonau Date: Fri, 6 Jan 2017 14:14:38 -0500 Subject: [PATCH 33/50] domains: monosnap no longer needed --- plugins/domains/monosnap.com.js | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 plugins/domains/monosnap.com.js diff --git a/plugins/domains/monosnap.com.js b/plugins/domains/monosnap.com.js deleted file mode 100644 index 48a789f12..000000000 --- a/plugins/domains/monosnap.com.js +++ /dev/null @@ -1,9 +0,0 @@ -module.exports = { - - re: [ - /^https?:\/\/monosnap\.com\/file\/[a-zA-Z0-9]+/i - ], - - mixins: ['*', 'og-image-rel-image'] - -}; \ No newline at end of file From 49a2fb7c0730431519676b2d16b31b07202daa9e Mon Sep 17 00:00:00 2001 From: Nazar Leush Date: Mon, 9 Jan 2017 17:23:18 +0200 Subject: [PATCH 34/50] [utils] do not return publication time if no timezone specified --- lib/utils.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/utils.js b/lib/utils.js index c177e40c4..97115a24b 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -471,7 +471,7 @@ exports.unifyDate = function(date) { date = date * 1000; } - return new Date(date).toISOString(); + return new Date(date).toISOString().replace(/T.+$/, ''); // Remove time (no timezone). } // TODO: time in format 'Mon, 29 October 2012 18:15:00' parsed as local timezone anyway. @@ -483,7 +483,17 @@ exports.unifyDate = function(date) { } if (!isNaN(timestamp)) { - return new Date(timestamp).toISOString(); + var dateStr = new Date(timestamp).toISOString(); + + // Remove time if no timezone specified. + if (!date.match(/Z$/i) // ISO date with Z at and. + && !date.match(/ \w+$/i) // GMT, UTC, ... + && !date.match(/[\+\-]\d+$/i)) { // +1000 -10 + + dateStr = dateStr.replace(/T.+$/, '') + } + + return dateStr; } // Bad date to parse. From aa2c39a31f053ee4aefd62f1530eaee6885ab1c2 Mon Sep 17 00:00:00 2001 From: Nazar Leush Date: Mon, 9 Jan 2017 18:19:23 +0200 Subject: [PATCH 35/50] [utils] fix detect timezone in date --- lib/utils.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/utils.js b/lib/utils.js index 97115a24b..6dcbc41ed 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -486,9 +486,9 @@ exports.unifyDate = function(date) { var dateStr = new Date(timestamp).toISOString(); // Remove time if no timezone specified. - if (!date.match(/Z$/i) // ISO date with Z at and. - && !date.match(/ \w+$/i) // GMT, UTC, ... - && !date.match(/[\+\-]\d+$/i)) { // +1000 -10 + if (!date.match(/Z$/i) // ISO date with Z at and. + && !date.match(/ \w+$/i) // GMT, UTC, ... + && !date.match(/\d\d:\d\d.*[\+\-]\d\d(:?\d\d)?$/i)) { // ISO 8601: +1000 -10 (YYYY-MM-DDThh:mm:ss[.sss]±hh:mm) dateStr = dateStr.replace(/T.+$/, '') } From cb1b40d95fcfcb15922dc2b5f8bea8d74b81778b Mon Sep 17 00:00:00 2001 From: Ivan Paramonau Date: Mon, 9 Jan 2017 15:37:10 -0500 Subject: [PATCH 36/50] google docs: handle enterprise accounts --- plugins/domains/google.com/docs.google.com.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/domains/google.com/docs.google.com.js b/plugins/domains/google.com/docs.google.com.js index 95bb84d21..82e90a427 100644 --- a/plugins/domains/google.com/docs.google.com.js +++ b/plugins/domains/google.com/docs.google.com.js @@ -3,7 +3,7 @@ module.exports = { provides: "schemaFileObject", re: [ - /https:\/\/(?:docs|drive)\.google\.com\/(forms|document|presentation|spreadsheets|file)\/d\/([a-zA-Z0-9_-]+)/i + /https:\/\/(?:docs|drive)\.google\.com\/(?:a\/[a-zA-Z0-9\-\_\.]+\/)?(forms|document|presentation|spreadsheets|file)\/d\/([a-zA-Z0-9_-]+)/i ], mixins: [ From d2af56da8bd70f4ded288afda10d147cb60f9ff9 Mon Sep 17 00:00:00 2001 From: Ivan Paramonau Date: Tue, 10 Jan 2017 08:29:41 -0500 Subject: [PATCH 37/50] domains: make Twitch faster --- lib/plugins/system/oembed/providers.json | 9 ++++++- plugins/domains/twitch.tv.js | 31 ++++++++++++++++++------ 2 files changed, 31 insertions(+), 9 deletions(-) diff --git a/lib/plugins/system/oembed/providers.json b/lib/plugins/system/oembed/providers.json index c279c3e27..03142fb3b 100644 --- a/lib/plugins/system/oembed/providers.json +++ b/lib/plugins/system/oembed/providers.json @@ -552,5 +552,12 @@ "reverbnation.com" ], "endpoint": "https://www.reverbnation.com/oembed" - } + }, + { + "name": "Twitch", + "templates": [ + "twitch.tv" + ], + "endpoint": "https://api.twitch.tv/v4/oembed" + } ] \ No newline at end of file diff --git a/plugins/domains/twitch.tv.js b/plugins/domains/twitch.tv.js index c8e0a8738..7bfb7081f 100644 --- a/plugins/domains/twitch.tv.js +++ b/plugins/domains/twitch.tv.js @@ -6,21 +6,35 @@ module.exports = { ], mixins: [ - "*" + "oembed-title", + "oembed-video", + "oembed-thumbnail", + "oembed-site", + "oembed-author", + "domain-icon" ], - getLink: function (urlMatch, og) { + getMeta: function (oembed) { + return { + date: oembed.created_at, + category: oembed.game, + duration: oembed.video_length, + canonical: oembed.request_url + } + }, + + getLink: function (urlMatch, oembed) { - if (/^video/i.test(og.type)) { + if (/^video/i.test(oembed.type)) { return !urlMatch[2] ? { - href: "//player.twitch.tv/?channel=" + urlMatch[1]+"&autoplay=false", + href: "//player.twitch.tv/?channel=" + urlMatch[1]+"&autoplay=true", type: CONFIG.T.text_html, - rel: [CONFIG.R.player, CONFIG.R.html5], + rel: [CONFIG.R.player, CONFIG.R.html5, CONFIG.R.autoplay], "aspect-ratio": 16 /9 } : { - href: "//player.twitch.tv/?video=v" + urlMatch[2], + href: "//player.twitch.tv/?video=v" + urlMatch[2]+'&autoplay=true', type: CONFIG.T.text_html, - rel: [CONFIG.R.player, CONFIG.R.autoplay, CONFIG.R.html5], + rel: [CONFIG.R.player, CONFIG.R.html5, CONFIG.R.autoplay], "aspect-ratio": 16 /9 }; } @@ -29,6 +43,7 @@ module.exports = { tests: [ "https://www.twitch.tv/imaqtpie", "http://www.twitch.tv/adultswim", - "https://www.twitch.tv/xleinonen" + "https://www.twitch.tv/xleinonen", + "https://www.twitch.tv/riotgames/v/72749628" ] }; \ No newline at end of file From 1e1ed7325f7afee07f9404ba8400387a74442dab Mon Sep 17 00:00:00 2001 From: Ivan Paramonau Date: Tue, 10 Jan 2017 12:17:06 -0500 Subject: [PATCH 38/50] domains: better sizes for spotify --- plugins/domains/spotify.com/spotify.com.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/domains/spotify.com/spotify.com.js b/plugins/domains/spotify.com/spotify.com.js index 102a738c4..78a49b101 100644 --- a/plugins/domains/spotify.com/spotify.com.js +++ b/plugins/domains/spotify.com/spotify.com.js @@ -29,7 +29,7 @@ module.exports = { href: $iframe.attr('src'), type: CONFIG.T.text_html, rel: [CONFIG.R.player, CONFIG.R.ssl, CONFIG.R.html5], - "aspect-ratio": 100 / 115 // hardcode here as otherwise there's blank space beneath the player + height: oembed.height || 80 }, { href: "http://d2c87l0yth4zbw.cloudfront.net/i/_global/favicon.png", type: CONFIG.T.image, From d3477e2744de0968533c895947283683d6759f4e Mon Sep 17 00:00:00 2001 From: Ivan Paramonau Date: Tue, 10 Jan 2017 14:24:23 -0500 Subject: [PATCH 39/50] core: do not look up known providers for publishers' blogs --- lib/plugins/system/oembed/oembedUtils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/plugins/system/oembed/oembedUtils.js b/lib/plugins/system/oembed/oembedUtils.js index 58205fc51..860eb9895 100644 --- a/lib/plugins/system/oembed/oembedUtils.js +++ b/lib/plugins/system/oembed/oembedUtils.js @@ -24,7 +24,7 @@ function lookupStaticProviders(uri) { var providers = require('./providers.json'); var protocolMatch = uri.match(/^(https?:\/\/)/); - if (!protocolMatch) { + if (!protocolMatch || /^https?:\/\/blog\./i.test(uri)) { return null; } var uri2 = uri.substr(protocolMatch[1].length); From 239661a61942cfeea8541d400263c3b59261bad0 Mon Sep 17 00:00:00 2001 From: Ivan Paramonau Date: Tue, 10 Jan 2017 14:33:56 -0500 Subject: [PATCH 40/50] app: add a few missing result code messages --- app.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app.js b/app.js index 20f04df71..cb8e749fc 100644 --- a/app.js +++ b/app.js @@ -121,9 +121,18 @@ function errorHandler(err, req, res, next) { else if (code === 403) { respondWithError(req, res, 403, 'Forbidden'); } + else if (code === 404) { + respondWithError(req, res, 404, 'Not found'); + } else if (code === 410) { respondWithError(req, res, 410, 'Gone'); } + else if (code === 415) { + respondWithError(req, res, 415, 'Unsupported Media Type'); + } + else if (code === 417) { + respondWithError(req, res, 417, 'Unsupported Media Type'); + } else { respondWithError(req, res, code, 'Server error'); } From 2770da3902b603ce5a04d306b0ceb0e69dfaf22a Mon Sep 17 00:00:00 2001 From: Ivan Paramonau Date: Wed, 11 Jan 2017 11:48:33 -0500 Subject: [PATCH 41/50] hosted podcasts: add podbean, simplecast and libsyn --- plugins/domains/libsyn.com.js | 1 + plugins/domains/podbean.com.js | 30 +++++---------------------- plugins/domains/simplecast.com.js | 30 +++++++++++++++++++++++++++ plugins/links/promo/known-players.js | 13 ++++++++++++ plugins/links/promo/libsyn-hosted.js | 27 ++++++++++++++++++++++++ plugins/links/promo/podbean-hosted.js | 20 ++++++++++++++++++ plugins/links/promo/twitter-hosted.js | 4 ++-- 7 files changed, 98 insertions(+), 27 deletions(-) create mode 100644 plugins/domains/simplecast.com.js create mode 100644 plugins/links/promo/libsyn-hosted.js create mode 100644 plugins/links/promo/podbean-hosted.js diff --git a/plugins/domains/libsyn.com.js b/plugins/domains/libsyn.com.js index 16c34d18f..a853d7f2f 100644 --- a/plugins/domains/libsyn.com.js +++ b/plugins/domains/libsyn.com.js @@ -22,6 +22,7 @@ module.exports = { player['padding-bottom'] = 90; } else { player.height = 90; + player.scrolling = 'no'; } return player; diff --git a/plugins/domains/podbean.com.js b/plugins/domains/podbean.com.js index a935583fb..d7a6db471 100644 --- a/plugins/domains/podbean.com.js +++ b/plugins/domains/podbean.com.js @@ -4,36 +4,16 @@ module.exports = { "*" ], - getLink: function(url, cheerio) { + getData: function(twitter) { + + if (twitter.player && twitter.player.value) { - // Iframe with video embed. - var $iframe = cheerio('.podPress_content iframe'); - if ($iframe.length) { return { - href: $iframe.attr('src').replace('http://', '//'), - type: CONFIG.T.text_html, - rel: [CONFIG.R.player, CONFIG.R.html5], - width: $iframe.attr('width'), - height: $iframe.attr('height') + video_src: twitter.player.value }; } - - // Generate audio embed. - var $post = cheerio('.post-toolbar'); - if ($post.length) { - var id_match = $post.attr('id').match(/postbar_(\d+)/); - - if (id_match) { - return { - href: '//www.podbean.com/media/player/audio/postId/' + id_match[1] + '/url/' + encodeURI(url) + '/initByJs/1/auto/1', - type: CONFIG.T.text_html, - rel: [CONFIG.R.player, CONFIG.R.html5], - 'min-width': 225, - height: 100 - }; - } - } }, + tests: [{ pageWithFeed: 'http://boyt.podbean.com' diff --git a/plugins/domains/simplecast.com.js b/plugins/domains/simplecast.com.js new file mode 100644 index 000000000..0ff776349 --- /dev/null +++ b/plugins/domains/simplecast.com.js @@ -0,0 +1,30 @@ +module.exports = { + + // used for hosted simplecasts + re: /https?:\/\/simplecast\.com\/card\/[a-zA-Z0-9\-]+/i, + + mixins: ["*"], + + getLink: function(urlMatch) { + + return { + href: urlMatch[0], + type: CONFIG.T.text_html, + rel: [CONFIG.R.player, CONFIG.R.html5, CONFIG.R.oembed], // oembed rel makes it pass url!=canonical validation + height: 94 + }; + }, + + tests: [ + "https://simplecast.com/card/6e203f4f" + /* + http://bikeshed.fm/54 + http://www.laravelpodcast.com/episodes/27610-episode-42-activerecord-the-school-of-zonda + http://www.laravelpodcast.com/episodes/32762-episode-43-open-source-money-rocket-league + http://bikeshed.fm/57 + http://www.laravelpodcast.com/episodes/55797-episode-51-dusky-christmas + http://www.travandlos.com/47 + http://podcast.emojiwrap.com/episodes/53140-4-but-some-people-hated-the-blob + */ + ] +}; \ No newline at end of file diff --git a/plugins/links/promo/known-players.js b/plugins/links/promo/known-players.js index 7d5351e6d..09501d2ee 100644 --- a/plugins/links/promo/known-players.js +++ b/plugins/links/promo/known-players.js @@ -84,5 +84,18 @@ module.exports = { }; } + // or simplecast + urlMatch = video_src.match(/https?:\/\/simplecast\.com\/card\/[a-zA-Z0-9\-]+/i); + + if (urlMatch) { + return { + __promoUri: { + url: urlMatch[0], + rel: 'No rel=promo is required' // this field is just for debugging here. Not required + } + }; + } + + } }; \ No newline at end of file diff --git a/plugins/links/promo/libsyn-hosted.js b/plugins/links/promo/libsyn-hosted.js new file mode 100644 index 000000000..52fa11251 --- /dev/null +++ b/plugins/links/promo/libsyn-hosted.js @@ -0,0 +1,27 @@ +module.exports = { + + getData: function(url, video_src, twitter) { + + var stream = twitter.player && twitter.player.stream && twitter.player.stream.value; + + if (stream + && /^https?:\/\/traffic\.libsyn\.com\/preview\/([a-zA-Z0-9\-]+)\//i.test(stream) + && /^https?:\/\/html5\-player\.libsyn\.com\/embed(\/episode\/id\/\d+)/i.test(video_src) + && /^https?:\/\/[a-z\.]+\//i.test(url)) { + + return { + __promoUri: { + url: 'http://' + stream.match(/^https?:\/\/traffic\.libsyn\.com\/preview\/([a-zA-Z0-9\-]+)\//i)[1] + + '.libsyn.com/' + + url.replace(/^https?:\/\/[a-z\.]+\//i, ''), + rel: 'No rel=promo is required' // this field is just for debugging here. Not required + } + }; + + } + } + + // http://trendfollowingradio.com/episode-1-the-trend-following-manifesto-with-michael-covel + // http://coloristpodcast.com/episode-005-terence-curren + +}; \ No newline at end of file diff --git a/plugins/links/promo/podbean-hosted.js b/plugins/links/promo/podbean-hosted.js new file mode 100644 index 000000000..daf4b1cea --- /dev/null +++ b/plugins/links/promo/podbean-hosted.js @@ -0,0 +1,20 @@ +module.exports = { + + //provides: 'oembedLinks', // do not uncomment - it breaks play.spotify.com atm + + getData: function(video_src) { + + if (/^https?:\/\/(?:www\.)?podbean\.com\/media\/player\/[^?]+/i.test(video_src)) { + + return {oembedLinks: [{ + href: "http://www.podbean.com/media/oembed?url=" + video_src.match(/^https?:\/\/(?:www\.)?podbean\.com\/media\/player\/[^?]+/i)[0], + rel: 'alternate', + type: 'application/json+oembed' + }]} + + } + } + + // http://audio.javascriptair.com/e/032-jsair-publishing-javascript-packages-with-john-david-dalton-stephan-bonnemann-james-kyle-and-henry-zhu/ + +}; \ No newline at end of file diff --git a/plugins/links/promo/twitter-hosted.js b/plugins/links/promo/twitter-hosted.js index f80739007..a5240105b 100644 --- a/plugins/links/promo/twitter-hosted.js +++ b/plugins/links/promo/twitter-hosted.js @@ -9,8 +9,8 @@ module.exports = { var video_src = (twitter.player && twitter.player.value) || twitter.player; if (video_src && typeof video_src === "string" - && /(youtube|youtu|vimeo|dailymotion|theplatform|jwplatform|cnevids|newsinc)\./i.test(video_src) - && !/(youtube|youtu|vimeo|dailymotion|theplatform|jwplatform|cnevids|newsinc)\./i.test(url)) { + && /(youtube|youtu|vimeo|dailymotion|theplatform|jwplatform|cnevids|newsinc|podbean|simplecast|libsyn)\./i.test(video_src) + && !/(youtube|youtu|vimeo|dailymotion|theplatform|jwplatform|cnevids|newsinc|libsyn)\./i.test(url)) { return { video_src: video_src From c5159e9f933748a6fb957e766804043c0d856e8d Mon Sep 17 00:00:00 2001 From: Ivan Paramonau Date: Wed, 11 Jan 2017 15:29:21 -0500 Subject: [PATCH 42/50] tests: fix v.qq.com --- plugins/domains/espnfc.com.js | 3 ++- plugins/domains/v.qq.com.js | 21 ++++++++++++++------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/plugins/domains/espnfc.com.js b/plugins/domains/espnfc.com.js index fc5b8b735..bcbe66788 100644 --- a/plugins/domains/espnfc.com.js +++ b/plugins/domains/espnfc.com.js @@ -1,7 +1,8 @@ module.exports = { re: [ - /^https?:\/\/(?:www\.)?espnfc\.com\/[a-zA-Z\-0-9]+\/\d{2,3}\/video\/(\d+)\/?/i + /^https?:\/\/(?:www\.)?espnfc\.(?:com|us|co\.uk|com\.au)\/[a-zA-Z\-0-9]+\/\d{2,3}\/video\/(\d+)\/?/i, + /^https?:\/\/(?:www\.)?espnfcasia\.com\/[a-zA-Z\-0-9]+\/\d{2,3}\/video\/(\d+)\/?/i ], mixins: ["*"], diff --git a/plugins/domains/v.qq.com.js b/plugins/domains/v.qq.com.js index 7ca33a0a9..eaf73e9ce 100644 --- a/plugins/domains/v.qq.com.js +++ b/plugins/domains/v.qq.com.js @@ -2,8 +2,9 @@ var _ = require('underscore'); var res = [ /^https?:\/\/v\.qq\.com\/page\/\w\/\w\/\w\/(\w+)\.html$/i, - /^https?:\/\/v\.qq\.com\/\w+\/page\/\w\/\w\/\w\/(\w+)\.html$/i, - /^https?:\/\/v\.qq\.com\/\w+\/\w\/\w+\.html\?vid=(\w+)$/i + /^https?:\/\/v\.qq\.com\/\w+\/page\/(\w+)\.html$/i, + /^https?:\/\/v\.qq\.com\/\w+\/\w\/\w+\.html\?vid=(\w+)$/i, + /^https?:\/\/v\.qq\.com\/iframe\/(?:player|preview)\.html\?vid=(\w+)/i ]; module.exports = { @@ -15,12 +16,18 @@ module.exports = { ], getLinks: function(urlMatch) { - return { - href: "http://static.video.qq.com/TPout.swf?vid=" + urlMatch[1], - type: CONFIG.T.flash, - rel: CONFIG.R.player + + return [{ + href: "https://v.qq.com/iframe/player.html?vid=" + urlMatch[1] + '&auto=0', + type: CONFIG.T.text_html, + rel: [CONFIG.R.player, CONFIG.R.html5] // "aspect-ratio": 4/3 // use default aspect instead - }; + }, { + href: "https://v.qq.com/iframe/player.html?vid=" + urlMatch[1] + '&auto=1', + type: CONFIG.T.text_html, + rel: [CONFIG.R.player, CONFIG.R.html5, CONFIG.R.autoplay] + // "aspect-ratio": 4/3 // use default aspect instead + }]; }, tests: [{ From de343ad4916ca2a9bbbd9def59d0682b66e3e34a Mon Sep 17 00:00:00 2001 From: Ivan Paramonau Date: Wed, 11 Jan 2017 16:58:01 -0500 Subject: [PATCH 43/50] tests: fix twitch --- lib/plugins/system/oembed/providers.json | 3 ++- plugins/domains/twitch.tv.js | 21 +++++++++------------ 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/lib/plugins/system/oembed/providers.json b/lib/plugins/system/oembed/providers.json index 03142fb3b..541d70b75 100644 --- a/lib/plugins/system/oembed/providers.json +++ b/lib/plugins/system/oembed/providers.json @@ -556,7 +556,8 @@ { "name": "Twitch", "templates": [ - "twitch.tv" + "twitch\\.tv/([a-zA-Z0-9_]+)/", + "clips.twitch.tv" ], "endpoint": "https://api.twitch.tv/v4/oembed" } diff --git a/plugins/domains/twitch.tv.js b/plugins/domains/twitch.tv.js index 7bfb7081f..7c7813dea 100644 --- a/plugins/domains/twitch.tv.js +++ b/plugins/domains/twitch.tv.js @@ -1,17 +1,12 @@ module.exports = { re: [ - /^https?:\/\/www\.twitch\.tv\/([a-zA-Z0-9_]+)$/i, - /^https?:\/\/www\.twitch\.tv\/([a-zA-Z0-9_]+)\/v\/(\d+)/i + /^https?:\/\/(?:www\.)?twitch\.tv\/([a-zA-Z0-9_]+)$/i, + /^https?:\/\/(?:www\.)?twitch\.tv\/([a-zA-Z0-9_]+)\/v\/(\d+)/i ], mixins: [ - "oembed-title", - "oembed-video", - "oembed-thumbnail", - "oembed-site", - "oembed-author", - "domain-icon" + "*" ], getMeta: function (oembed) { @@ -23,13 +18,15 @@ module.exports = { } }, - getLink: function (urlMatch, oembed) { + getLink: function (urlMatch, og) { - if (/^video/i.test(oembed.type)) { + if (og.video) { //skip e.g. https://www.twitch.tv/store + + // add only potentially missing options for each a channel and a clip return !urlMatch[2] ? { - href: "//player.twitch.tv/?channel=" + urlMatch[1]+"&autoplay=true", + href: "//player.twitch.tv/?channel=" + urlMatch[1]+"&autoplay=false", type: CONFIG.T.text_html, - rel: [CONFIG.R.player, CONFIG.R.html5, CONFIG.R.autoplay], + rel: [CONFIG.R.player, CONFIG.R.html5], "aspect-ratio": 16 /9 } : { href: "//player.twitch.tv/?video=v" + urlMatch[2]+'&autoplay=true', From d492a65ee36336cc74a19a8f1a656d872d538a2f Mon Sep 17 00:00:00 2001 From: Ivan Paramonau Date: Thu, 12 Jan 2017 09:56:27 -0500 Subject: [PATCH 44/50] tests: fix naver --- plugins/domains/tvcast.naver.com.js | 2 +- plugins/domains/twitch.tv.js | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/domains/tvcast.naver.com.js b/plugins/domains/tvcast.naver.com.js index 6eb66661b..452586d98 100644 --- a/plugins/domains/tvcast.naver.com.js +++ b/plugins/domains/tvcast.naver.com.js @@ -3,7 +3,7 @@ var cheerio = require('cheerio'); module.exports = { re: [ - /^https?:\/\/tvcast\.naver\.com\/v\/(\d+)/i + /^https?:\/\/(?:tvcast|tv)\.naver\.com\/v\/(\d+)/i ], mixins: ['*'], diff --git a/plugins/domains/twitch.tv.js b/plugins/domains/twitch.tv.js index 7c7813dea..01c281d60 100644 --- a/plugins/domains/twitch.tv.js +++ b/plugins/domains/twitch.tv.js @@ -37,7 +37,9 @@ module.exports = { } }, - tests: [ + tests: [{ + noFeeds: true, skipMethods: ["getMeta"] + }, "https://www.twitch.tv/imaqtpie", "http://www.twitch.tv/adultswim", "https://www.twitch.tv/xleinonen", From 1d8107f3b7a32c963c593bdb6b53f6d21c4ea7fb Mon Sep 17 00:00:00 2001 From: Ivan Paramonau Date: Thu, 12 Jan 2017 10:44:59 -0500 Subject: [PATCH 45/50] domains: hotfix for vevo --- plugins/domains/vevo.com.js | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/plugins/domains/vevo.com.js b/plugins/domains/vevo.com.js index 21cdb2105..247a59514 100644 --- a/plugins/domains/vevo.com.js +++ b/plugins/domains/vevo.com.js @@ -4,28 +4,34 @@ var QueryString = require("querystring"); module.exports = { re:[ - /^https?:\/\/www\.vevo\.com\/watch\//i + /^https?:\/\/www\.vevo\.com\/watch\/[^\/]+\/[^\/]+\/([a-zA-Z0-9]+)/i, + /^https?:\/\/www\.vevo\.com\/watch\/([a-zA-Z0-9]+)/i ], mixins: [ "*" ], - getLinks: function (twitter, whitelistRecord) { + getLinks: function (urlMatch) { + /* if ((whitelistRecord.isDefault || !whitelistRecord.isAllowed('twitter.player') || whitelistRecord.isAllowed('twitter.player', 'autoplay')) && twitter.player) { var href = URL.parse(twitter.player.value, true); var query = href.query; if (query.isrc) { + */ - return [{ - href: 'https://scache.vevo.com/assets/html/embed.html?video=' + query.isrc + '&autoplay=0', + return { + href: 'https://scache.vevo.com/assets/html/embed.html?video=' + urlMatch[1] + '&autoplay=0', type: CONFIG.T.text_html, - rel: [CONFIG.R.player, CONFIG.R.html5], - "aspect-ratio": twitter.player.width / twitter.player.height - }, { + rel: [CONFIG.R.player, CONFIG.R.html5] + //"aspect-ratio": twitter.player.width / twitter.player.height + } + + /* + , { href: 'http://cache.vevo.com/assets/html/embed.html?video=' + query.isrc + '&autoplay=0', type: CONFIG.T.text_html, rel: [CONFIG.R.player, CONFIG.R.html5], @@ -33,9 +39,11 @@ module.exports = { }] } } + */ }, tests: [ - "http://www.vevo.com/watch/ellie-goulding/Still-Falling-For-You/GBUV71601272" + "http://www.vevo.com/watch/ellie-goulding/Still-Falling-For-You/GBUV71601272", + "http://www.vevo.com/watch/USQX91700004?isrc=USQX91700004&utm_campaign=ing&share_location=ingestion" ] }; \ No newline at end of file From 9f50bdaaa52870ff5fe4414d84bf08cf00341aae Mon Sep 17 00:00:00 2001 From: Ivan Paramonau Date: Thu, 12 Jan 2017 10:47:26 -0500 Subject: [PATCH 46/50] vevo: better condition for when the hotfix is used --- plugins/domains/vevo.com.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/domains/vevo.com.js b/plugins/domains/vevo.com.js index 247a59514..4c1da2579 100644 --- a/plugins/domains/vevo.com.js +++ b/plugins/domains/vevo.com.js @@ -12,7 +12,7 @@ module.exports = { "*" ], - getLinks: function (urlMatch) { + getLinks: function (urlMatch, meta) { /* if ((whitelistRecord.isDefault || !whitelistRecord.isAllowed('twitter.player') || whitelistRecord.isAllowed('twitter.player', 'autoplay')) && twitter.player) { @@ -23,12 +23,15 @@ module.exports = { if (query.isrc) { */ + if (!meta.twitter) { + return { href: 'https://scache.vevo.com/assets/html/embed.html?video=' + urlMatch[1] + '&autoplay=0', type: CONFIG.T.text_html, rel: [CONFIG.R.player, CONFIG.R.html5] //"aspect-ratio": twitter.player.width / twitter.player.height } + } /* , { From ecc98f2b6956797a880f73065ea5b8887ee5c25a Mon Sep 17 00:00:00 2001 From: Ivan Paramonau Date: Thu, 12 Jan 2017 10:52:59 -0500 Subject: [PATCH 47/50] tests: fix more of v.qq.com --- plugins/domains/v.qq.com.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/domains/v.qq.com.js b/plugins/domains/v.qq.com.js index eaf73e9ce..9867a9a52 100644 --- a/plugins/domains/v.qq.com.js +++ b/plugins/domains/v.qq.com.js @@ -4,7 +4,8 @@ var res = [ /^https?:\/\/v\.qq\.com\/page\/\w\/\w\/\w\/(\w+)\.html$/i, /^https?:\/\/v\.qq\.com\/\w+\/page\/(\w+)\.html$/i, /^https?:\/\/v\.qq\.com\/\w+\/\w\/\w+\.html\?vid=(\w+)$/i, - /^https?:\/\/v\.qq\.com\/iframe\/(?:player|preview)\.html\?vid=(\w+)/i + /^https?:\/\/v\.qq\.com\/iframe\/(?:player|preview)\.html\?vid=(\w+)/i, + /^https?:\/\/v\.qq\.com\/\w\/cover\/\w+\/(\w+)\.html/i ]; module.exports = { From 81539be17e8557893b150c483db21fc1fda3675c Mon Sep 17 00:00:00 2001 From: Ivan Paramonau Date: Thu, 12 Jan 2017 12:46:41 -0500 Subject: [PATCH 48/50] what's new for v 1.0.2 --- WHATSNEW.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/WHATSNEW.md b/WHATSNEW.md index 3b2f282a6..b60a59eea 100644 --- a/WHATSNEW.md +++ b/WHATSNEW.md @@ -4,6 +4,13 @@ This is the history of the Iframely changes. Updates that are older than one yea To stay tuned and up-to-date, watch [Iframely on GitHub](https://github.com/itteco/iframely). +### 2017.01.12, Version 1.0.2 + +- Maintenance of the domain plugins +- Better consistency in product prices and article timestamps +- Added custom domains for hosted podcasts: podbean, simplecast and libsyn + + ### 2016.12.15, Version 1.0.1 - Maintenance of the domain plugins From 2777d94775faa6cd0b4215959c528a7a802396e1 Mon Sep 17 00:00:00 2001 From: Nazar Leush Date: Thu, 12 Jan 2017 20:24:57 +0200 Subject: [PATCH 49/50] fix test --- test/e2e.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/e2e.js b/test/e2e.js index 9b180d2ea..b23ca0901 100644 --- a/test/e2e.js +++ b/test/e2e.js @@ -91,7 +91,7 @@ describe('meta endpoint', function() { error: { source: 'iframely', code: 417, - message: 'Server error' + message: 'Unsupported Media Type' } }); done(err); From 686b4215b6760cb860575d78b03053239638b8ef Mon Sep 17 00:00:00 2001 From: Nazar Leush Date: Thu, 12 Jan 2017 20:38:33 +0200 Subject: [PATCH 50/50] update version to 1.0.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2d9b4cc65..14e679f18 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "iframely", - "version": "1.0.1", + "version": "1.0.2", "description": "oEmbed/2 gateway endpoint. Get embed data for various http links through one self-hosted API", "keywords": ["oembed", "embed", "open graph", "og", "twitter cards"],