Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion lib/plugins/system/oembed/oembed.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,15 @@ export default {

getData: function(url, oembedLinks, oembedUtils, options, cb) {

var href = oembedLinks[0].href;
const weights = {
'application/json+oembed': -1,
'text/xml+oembed': 1
}

var href = oembedLinks.sort(
// Prefer JSON
(a,b) => a.type && b.type && (weights[a.type.toLowerCase()] - weights[b.type.toLowerCase()]) || 0
)[0].href;

var skip = CONFIG.SKIP_OEMBED_RE_LIST
&& CONFIG.SKIP_OEMBED_RE_LIST.some(re => re.test(href)),
Expand Down
6 changes: 4 additions & 2 deletions lib/plugins/system/oembed/oembedUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -379,8 +379,10 @@ function xmlStream2oembed(stream, callback) {
} else {
if (prop) {

if (charset !== 'UTF-8') {
// Decode only non UTF-8 because sax makes decoding.
if (charset /* !== 'UTF-8' */) { // previouly - Decode only non UTF-8 because sax makes decoding.
// UTF-8 is not decoded by default in July 2026
// Ex.: https://rutube.ru/video/bf4825090681c5c25312534bab3c7f62/

var oldValue = value;
value = encodeText(charset, value);
// log(' -- decode oembed xml (charset, in, out):', charset, oldValue, value);
Expand Down
Loading