diff --git a/src/main/java/me/kavin/piped/utils/ChannelHelpers.java b/src/main/java/me/kavin/piped/utils/ChannelHelpers.java index cee7e79..63ecf0e 100644 --- a/src/main/java/me/kavin/piped/utils/ChannelHelpers.java +++ b/src/main/java/me/kavin/piped/utils/ChannelHelpers.java @@ -1,19 +1,14 @@ package me.kavin.piped.utils; +import com.rometools.rome.feed.synd.*; import me.kavin.piped.consts.Constants; import me.kavin.piped.utils.obj.db.Channel; import me.kavin.piped.utils.obj.db.Video; import okhttp3.Request; import org.apache.commons.lang3.StringUtils; +import org.apache.commons.text.StringEscapeUtils; import org.hibernate.StatelessSession; -import com.rometools.rome.feed.synd.SyndContent; -import com.rometools.rome.feed.synd.SyndContentImpl; -import com.rometools.rome.feed.synd.SyndEntry; -import com.rometools.rome.feed.synd.SyndEntryImpl; -import com.rometools.rome.feed.synd.SyndPerson; -import com.rometools.rome.feed.synd.SyndPersonImpl; - import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; @@ -75,7 +70,7 @@ public class ChannelHelpers { SyndPerson person = new SyndPersonImpl(); SyndContent content = new SyndContentImpl(); SyndContent thumbnail = new SyndContentImpl(); - + person.setName(channel.getUploader()); person.setUri(Constants.FRONTEND_URL + "/channel/" + channel.getUploaderId()); entry.setAuthors(Collections.singletonList(person)); @@ -87,12 +82,17 @@ public class ChannelHelpers { String contentText = String.format("Title: %s\nViews: %d\nId: %s\nDuration: %d\nIs YT Shorts: %b", video.getTitle(), video.getViews(), video.getId(), video.getDuration(), video.isShort()); content.setValue(contentText); - String thumbnailContent = String.format("", Constants.FRONTEND_URL + "/watch?v=" + video.getId(), video.getThumbnail()); + String thumbnailContent = StringEscapeUtils.escapeXml11( + String.format("
", + Constants.FRONTEND_URL + "/watch?v=" + video.getId() + , video.getThumbnail() + ) + ); thumbnail.setType("xhtml"); thumbnail.setValue(thumbnailContent); entry.setContents(List.of(thumbnail, content)); - + return entry; } }