Skip to content

Commit 0489467

Browse files
committed
cut script and blockquote elements
1 parent 874f276 commit 0489467

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

internal/fetcher/sites/cna/cna.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,8 @@ func cna(p *Post) (string, error) {
147147

148148
re := regexp.MustCompile(`<a.*?>`)
149149
body = re.ReplaceAllString(body, "")
150+
re = regexp.MustCompile(`<script.*?</script>`)
151+
body = re.ReplaceAllString(body, "")
150152
re = regexp.MustCompile(`<iframe.*?</iframe>`)
151153
body = re.ReplaceAllString(body, "")
152154

internal/fetcher/sites/ltn/ltn.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,10 @@ func ltn(p *Post) (string, error) {
134134
body = re.ReplaceAllString(body, "")
135135
re = regexp.MustCompile(`</a>`)
136136
body = re.ReplaceAllString(body, "")
137+
re = regexp.MustCompile(`<script.*?</script>`)
138+
body = re.ReplaceAllString(body, "")
139+
re = regexp.MustCompile(`<blockquote.*?</blockquote>`)
140+
body = re.ReplaceAllString(body, "")
137141
re = regexp.MustCompile(`<iframe.*?</iframe>`)
138142
body = re.ReplaceAllString(body, "")
139143

0 commit comments

Comments
 (0)