-
Notifications
You must be signed in to change notification settings - Fork 12
/
presets.js
65 lines (63 loc) · 1.81 KB
/
presets.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
export default {
default: {
getId: (data) => {
return data.id
},
format: (data) => {
return {
content: data.content,
date: data.isoDate,
}
}
},
statuslol: {
getId: (data) => {
return data.id
},
format: (data) => {
return {
content: data.summary,
date: data.isoDate,
}
}
},
letterboxd: {
getId: (data) => {
return data.guid
},
format: (data) => {
let content = data.content.trim()
content = `${data.title}
${content}`
return {
content: content.trim(),
date: new Date(data.isoDate).toISOString(),
}
}
},
letterboxdNoPoster: {
getId: (data) => {
return data.guid
},
format: (data) => {
const SPOILER_TEXT = '<p><em>This review may contain spoilers.</em></p>'
const SPOILER_TEXT_REVIEW = ' (contains spoilers)'
let content = data.content.trim()
data.title = data.title.replace(SPOILER_TEXT_REVIEW, '')
const spoilers = content.includes(SPOILER_TEXT) ? data['letterboxd:filmTitle'] : false
content = content.replace(SPOILER_TEXT, '')
// remove movie poster from content
if (data.content.includes('img src='))
{
content = content.replace(content.match(/(<p>.*?<\/p>)/g)[0], '')
}
content = `${data.title}
${content}`
return {
content: content,
date: new Date(data.isoDate).toISOString(),
spoilers: spoilers,
}
}
},
}