diff --git a/index.js b/index.js
index 34eebb9..88e247b 100644
--- a/index.js
+++ b/index.js
@@ -157,6 +157,21 @@ function initTurndownService() {
replacement: (content, node) => '\n\n' + node.outerHTML + '\n\n'
});
+ // preserve iframes (common for embedded audio/video)
+ // other solutions via blankRule() and keep() did not work for me
+ // that's why getPostContent() adds a "." to make ', '');
+ return '\n\n' + html + '\n\n';
+ }
+ });
+
+
return turndownService;
}
@@ -189,10 +204,13 @@ function getPostDate(post) {
function getPostContent(post, turndownService) {
let content = post.encoded[0].trim();
+ // this is for a workaround/hack in initTurndownService()
+ content = content.replace(/<\/iframe>/gi, '.$&');
+
if (argv.addcontentimages) {
// writeImageFile() will save all content images to a relative /images folder
// so update references in post content to match
- content = content.replace(/
]*)src=".*?([^\/"]+\.(?:gif|jpg|png))"([^>]*)>/gi, '
');
+ content = content.replace(/(
]*src=").*?([^\/"]+\.(?:gif|jpg|png))("[^>]*>)/gi, '$1images/$2$3');
}
content = turndownService.turndown(content)