diff --git a/reader/rewrite/rewrite_functions.go b/reader/rewrite/rewrite_functions.go
index c5f930fe..b5b52409 100644
--- a/reader/rewrite/rewrite_functions.go
+++ b/reader/rewrite/rewrite_functions.go
@@ -282,3 +282,9 @@ func removeCustom(entryContent string, selector string) string {
output, _ := doc.Find("body").First().Html()
return output
}
+
+func addCastopodEpisode(entryURL, entryContent string) string {
+ player := ``
+
+ return player + `
` + entryContent
+}
diff --git a/reader/rewrite/rewriter.go b/reader/rewrite/rewriter.go
index e806bf16..feb0139e 100644
--- a/reader/rewrite/rewriter.go
+++ b/reader/rewrite/rewriter.go
@@ -100,6 +100,8 @@ func applyRule(entryURL, entryContent string, rule rule) string {
} else {
logger.Debug("[Rewrite] Cannot find selector for remove rule %s", rule)
}
+ case "add_castopod_episode":
+ entryContent = addCastopodEpisode(entryURL, entryContent)
}
return entryContent
diff --git a/reader/rewrite/rewriter_test.go b/reader/rewrite/rewriter_test.go
index 38e3df93..f796da7d 100644
--- a/reader/rewrite/rewriter_test.go
+++ b/reader/rewrite/rewriter_test.go
@@ -286,3 +286,12 @@ func TestRewriteRemoveCustom(t *testing.T) {
t.Errorf(`Not expected output: %s`, output)
}
}
+
+func TestRewriteAddCastopodEpisode(t *testing.T) {
+ output := Rewriter("https://podcast.demo/@demo/episodes/test", "Episode Description", `add_castopod_episode`)
+ expected := `
Episode Description`
+
+ if expected != output {
+ t.Errorf(`Not expected output: got "%s" instead of "%s"`, output, expected)
+ }
+}