mirror of
https://github.com/miniflux/v2.git
synced 2025-08-01 17:38:37 +00:00
Add rewrite rule to fix Medium.com images
This commit is contained in:
parent
d75ff0c5ab
commit
31435ef83e
6 changed files with 89 additions and 40 deletions
|
@ -139,6 +139,21 @@ func addDynamicImage(entryURL, entryContent string) string {
|
|||
return entryContent
|
||||
}
|
||||
|
||||
func fixMediumImages(entryURL, entryContent string) string {
|
||||
doc, err := goquery.NewDocumentFromReader(strings.NewReader(entryContent))
|
||||
if err != nil {
|
||||
return entryContent
|
||||
}
|
||||
|
||||
doc.Find("figure.paragraph-image").Each(func(i int, paragraphImage *goquery.Selection) {
|
||||
noscriptElement := paragraphImage.Find("noscript")
|
||||
paragraphImage.ReplaceWithHtml(noscriptElement.Text())
|
||||
})
|
||||
|
||||
output, _ := doc.Find("body").First().Html()
|
||||
return output
|
||||
}
|
||||
|
||||
func addYoutubeVideo(entryURL, entryContent string) string {
|
||||
matches := youtubeRegex.FindStringSubmatch(entryURL)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue