From 4aaf24f3b370612485fc15f18efc94ce7536e3a5 Mon Sep 17 00:00:00 2001 From: Jan-Lukas Else Date: Tue, 2 Jun 2020 13:15:25 +0200 Subject: [PATCH] HTML-encode content --- index.js | 5 +++-- package.json | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 14c58b2..1d43e35 100644 --- a/index.js +++ b/index.js @@ -1,5 +1,6 @@ const express = require('express') const scraper = require('tiktok-scraper') +const he = require('he') const app = express() const port = 8080 @@ -18,8 +19,8 @@ app.get('/user/:user', async (req, res) => { for (const post of posts.collector) { feed.items.push({ "id": post.id, - "title": post.text, - "content_text": post.text, + "title": `Post by @${user}`, + "content_html": he.encode(post.text), "url": post.webVideoUrl, "date_published": new Date(parseInt(post.createTime, 10) * 1000), "attachments": [ diff --git a/package.json b/package.json index 6ca7383..a1deb15 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "license": "MIT", "dependencies": { "express": "^4.17.1", - "tiktok-scraper": "^1.1.10" + "he": "^1.2.0", + "tiktok-scraper": "^1.1.13" } }