-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(article): slack message for safe
- Loading branch information
1 parent
ceef3a9
commit e44c3c7
Showing
11 changed files
with
284 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
backend/src/main/java/wooteco/prolog/article/application/RssClient.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package wooteco.prolog.article.application; | ||
|
||
import com.rometools.rome.feed.synd.SyndFeed; | ||
import com.rometools.rome.io.SyndFeedInput; | ||
import com.rometools.rome.io.XmlReader; | ||
import org.springframework.stereotype.Component; | ||
import wooteco.prolog.article.domain.RssFeed; | ||
import wooteco.prolog.article.domain.RssFeeds; | ||
|
||
import java.net.URL; | ||
import java.util.ArrayList; | ||
|
||
import static java.util.stream.Collectors.toList; | ||
|
||
@Component | ||
public class RssClient { | ||
public RssFeeds fromRssFeedBy(String feedUrl) { | ||
try { | ||
URL feedSource = new URL(feedUrl); | ||
SyndFeedInput input = new SyndFeedInput(); | ||
SyndFeed syndFeed = input.build(new XmlReader(feedSource)); | ||
String defaultImageUrl = RssFeed.extractDefaultImageUrl(syndFeed); | ||
|
||
return new RssFeeds(syndFeed.getEntries().stream() | ||
.map(it -> RssFeed.of(it, defaultImageUrl)) | ||
.collect(toList())); | ||
|
||
} catch (Exception e) { | ||
e.printStackTrace(); | ||
return new RssFeeds(new ArrayList<>()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 0 additions & 48 deletions
48
backend/src/main/java/wooteco/prolog/article/domain/Articles.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.