jlelse
/
TikTokJsonFeed
Archived
1
Fork 0

HTML-encode content
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Jan-Lukas Else 2020-06-02 13:15:25 +02:00
parent ad28c3515c
commit 4aaf24f3b3
2 changed files with 5 additions and 3 deletions

View File

@ -1,5 +1,6 @@
const express = require('express') const express = require('express')
const scraper = require('tiktok-scraper') const scraper = require('tiktok-scraper')
const he = require('he')
const app = express() const app = express()
const port = 8080 const port = 8080
@ -18,8 +19,8 @@ app.get('/user/:user', async (req, res) => {
for (const post of posts.collector) { for (const post of posts.collector) {
feed.items.push({ feed.items.push({
"id": post.id, "id": post.id,
"title": post.text, "title": `Post by @${user}`,
"content_text": post.text, "content_html": he.encode(post.text),
"url": post.webVideoUrl, "url": post.webVideoUrl,
"date_published": new Date(parseInt(post.createTime, 10) * 1000), "date_published": new Date(parseInt(post.createTime, 10) * 1000),
"attachments": [ "attachments": [

View File

@ -14,6 +14,7 @@
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"express": "^4.17.1", "express": "^4.17.1",
"tiktok-scraper": "^1.1.10" "he": "^1.2.0",
"tiktok-scraper": "^1.1.13"
} }
} }