Skip to content

Commit bc807bd

Browse files
committed
Fix
1 parent 51b4c2f commit bc807bd

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

index.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ Embedify.prototype.parseResponse = function parseResponse(response) {
153153

154154
const result = {
155155
type: oEmbed.type,
156-
version: oEmbed.version ? oEmbed.version.toString() : undefined,
156+
version: oEmbed.version ? oEmbed.version.toString() : null,
157157
title: oEmbed.title,
158158
html: oEmbed.html,
159159
author: {
@@ -166,11 +166,11 @@ Embedify.prototype.parseResponse = function parseResponse(response) {
166166
},
167167
image: {
168168
url: oEmbed.thumbnail_url,
169-
width: parseInt(oEmbed.thumbnail_width, 10),
170-
height: parseInt(oEmbed.thumbnail_height, 10),
169+
width: parseInt(oEmbed.thumbnail_width, 10) || null,
170+
height: parseInt(oEmbed.thumbnail_height, 10) || null,
171171
},
172-
width: parseInt(oEmbed.width, 10),
173-
height: parseInt(oEmbed.height, 10),
172+
width: parseInt(oEmbed.width, 10) || null,
173+
height: parseInt(oEmbed.height, 10) || null,
174174
};
175175

176176
deepCleanNull(result);

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "embedify",
3-
"version": "4.0.4",
3+
"version": "4.0.5",
44
"description": "oEmbed library for Soundcloud, Spotify, Vimeo and Youtube",
55
"main": "index.js",
66
"scripts": {

sample.js

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ const embedify = require('./index');
33
const url = [
44
'https://www.youtube.com/embed/iOf7CsxmFCs',
55
'https://play.spotify.com/track/4th1RQAelzqgY7wL53UGQt',
6+
'https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/265653966&auto_play=false&hide_related=false&show_comments=true&show_user=true&show_reposts=false&visual=true',
67
];
78

89
const oEmbed = embedify.create({ parse: true, failSoft: true });

0 commit comments

Comments
 (0)