jsonObject.put("link", entry.getLink().toString()); jsonObject.put("uri", entry.getUri().toString()); jsonObject.put("guid", Integer.toString(entry.hashCode()));
@Override public String getLink() { return rssEntry.getLink(); }
private static Dataset datasetFor(Dataset datasetOrig, SyndEntry entry) { String citation = StringUtils.trim(entry.getDescription().getValue()); String archiveURI = StringUtils.trim(entry.getLink()); return embeddedDatasetFor(datasetOrig, citation, URI.create(archiveURI)); }
/** * Render the given <code>Item</code> using Radeox macros. * <ul> * <li>The item title is wrapped in <code>__bold__</code></li> * <li>The link is rendered using the <code>{link}</code> macro.</li> * <li>If present, the item description is wrapped in <code>{quote}</code> macro tags.</li> * </ul> * @param buf the StringBuffer we're using to prepare the output * @param paramObj our parameter helper object */ private void renderEntryDefault(SyndEntry entry, StringBuffer buf, RSSMacroParameters paramObj) { buf.append(NEWLINE).append("* "); if (entry.getLink() != null) { buf.append("{link:"); } buf.append(entry.getTitle()); if (entry.getLink() != null) { buf.append("|") .append(entry.getLink()) .append("}"); } if (paramObj.isFull() && entry.getDescription() != null) { buf.append(NEWLINE).append("{quote}") .append(NEWLINE).append(entry.getDescription().getValue()) .append(NEWLINE).append("{quote}"); } }
buf.append(NEWLINE).append("<div class='rssitem'>"); buf.append(NEWLINE).append("<div class='rssitemtitle'>").append(NEWLINE); if (entry.getLink() != null) .append(Encoder.escape(entry.getLink())) .append("\">"); if (entry.getLink() != null) { buf.append("</a>"); } buf.append(NEWLINE).append("</div>"); // close rss.item.title if (paramObj.isFull() && entry.getDescription() != null)
/** * Fetches the news from the specified URL and returns the titles. */ public List<String> getNews(String newsUrl) { // Fetch news titles: List<String> newsTitles = new ArrayList<String>(); try { String rssFeed = new String(); URL feedSource = new URL(newsUrl); SyndFeedInput fi = new SyndFeedInput(); SyndFeed feed = fi.build(new XmlReader(feedSource)); for (Iterator i = feed.getEntries().iterator(); i.hasNext(); ) { SyndEntry entry = (SyndEntry) i.next(); String title = entry.getTitle(); title = title.substring(0, title.lastIndexOf("-")); String catPhrase = " "; // Get the body of the news. String content = getContent(entry.getLink(), catPhrase); newsTitles.add(title + "###" + content); } } catch (MalformedURLException e) { ; } catch (IOException e) { ; } catch (FeedException e) { ; } return newsTitles; }
System.out.println(" Description: " + Jsoup.parse(entry.getDescription().getValue()).text()); System.out.println(" Date: " + entry.getPublishedDate()); System.out.println(" Link: " + entry.getLink());
public void run ( ) { while ( isActive( ) ) { try { Thread.sleep( rate ); rss_input = new SyndFeedInput(); feed = rss_input.build(new XmlReader(url)); for (SyndEntry entry: (List<SyndEntry>) feed.getEntries()) { String title = entry.getTitle(); String link = entry.getLink(); String description= entry.getDescription().getValue(); String author = entry.getAuthor(); long publish_date = entry.getPublishedDate().getTime(); postStreamElement(publish_date,new Serializable[] {title,author,description,link}); } }catch (com.sun.syndication.io.FeedException e){ logger.error( e.getMessage( ) , e ); }catch ( InterruptedException e ) { logger.error( e.getMessage( ) , e ); }catch (IOException e) { logger.error( e.getMessage( ) , e ); } } }
private static List<Document> extractDocuments(Pair<SyndFeed, List<SyndEntry>> feedEntry) { List<Document> ret = new ArrayList<>(); feedEntry.getRight().forEach(e -> { FeedUtils.mergeAuthors(e); String description = e.getDescription() != null ? FeedUtils.clean(e.getDescription().getValue()) : StringUtils.EMPTY; if (description.length() > FeedConstants.MAX_DESCRIP_LEN) { description = FeedUtils.truncate(description, FeedConstants.MAX_DESCRIP_LEN); } ret.add(Document.of( StringEscapeUtils.unescapeHtml4(e.getTitle()), e.getPublishedDate(), e.getAuthors(), description, e.getLink(), feedEntry.getLeft().getTitle() )); }); return ret; }
private void buildListHTML(HtmlBuffer buf, SyndFeed feed){ List entries = feed.getEntries(); if(entries != null){ buf.appendStartTag("dl"); for(Iterator i = entries.iterator();i.hasNext();){ SyndEntry entry = (SyndEntry) i.next(); buf.appendStartTag("dt"); buf.setNewline(false); buf.appendAnchor(entry.getLink(),entry.getTitle()); if(entry.getPublishedDate() != null) buf.appendBody(HtmlBuffer.ENTITY_SPACE + CmsConstants.DATEFORMAT.format(entry.getPublishedDate())); buf.setNewline(true); buf.endTag(); buf.appendStartTag("dd"); buf.appendBody(entry.getDescription().getValue()); buf.endTag(); //tr } buf.endTag(); } }
protected Item createRSSItem(SyndEntry sEntry) { Item item = new Item(); item.setModules(ModuleUtils.cloneModules(sEntry.getModules())); item.setTitle(sEntry.getTitle()); item.setLink(sEntry.getLink()); if (((List)sEntry.getForeignMarkup()).size() > 0) { item.setForeignMarkup(sEntry.getForeignMarkup()); } String uri = sEntry.getUri(); if (uri != null) { item.setUri(uri); } return item; }
protected Item createRSSItem(SyndEntry sEntry) { Item item = new Item(); item.setModules(ModuleUtils.cloneModules(sEntry.getModules())); item.setTitle(sEntry.getTitle()); item.setLink(sEntry.getLink()); if (((List)sEntry.getForeignMarkup()).size() > 0) { item.setForeignMarkup(sEntry.getForeignMarkup()); } String uri = sEntry.getUri(); if (uri != null) { item.setUri(uri); } return item; }
protected Item createRSSItem(SyndEntry sEntry) { Item item = new Item(); item.setModules(ModuleUtils.cloneModules(sEntry.getModules())); item.setTitle(sEntry.getTitle()); item.setLink(sEntry.getLink()); if (((List)sEntry.getForeignMarkup()).size() > 0) { item.setForeignMarkup(sEntry.getForeignMarkup()); } String uri = sEntry.getUri(); if (uri != null) { item.setUri(uri); } return item; }
SyndEntry entry; for (int i = 0; i < feed.getEntries().size(); i++) { entry = (SyndEntry) result.getEntries().get(i); Log.e("Entry ", "==================================================================="); Log.e("Entry ", "Title : "+entry.getTitle()); Log.e("Entry ", "Link : "+entry.getLink()); Log.e("Entry ", "Uri : "+entry.getUri()); Log.e("Entry ", "Description : "+entry.getDescription().getValue()); SyndEnclosure enc = (SyndEnclosure) entry.getEnclosures().get(0); Log.e("Entry ", "URL : "+enc.getUrl()); Log.e("Entry ", "Length : "+enc.getLength()); Log.e("Entry ", "Type : "+enc.getType()); Log.e("Entry ", "Pub Date : "+entry.getPublishedDate()); Log.e("Entry ", "==================================================================="); }
protected Item createRSSItem(SyndEntry sEntry) { Item item = new Item(); item.setModules(ModuleUtils.cloneModules(sEntry.getModules())); item.setTitle(sEntry.getTitle()); item.setLink(sEntry.getLink()); if (((List)sEntry.getForeignMarkup()).size() > 0) { item.setForeignMarkup(sEntry.getForeignMarkup()); } String uri = sEntry.getUri(); if (uri != null) { item.setUri(uri); } return item; }
protected Item createRSSItem(SyndEntry sEntry) { Item item = super.createRSSItem(sEntry); if (sEntry.getAuthors()!=null && sEntry.getAuthors().size() > 0) { SyndPerson author = (SyndPerson)sEntry.getAuthors().get(0); item.setAuthor(author.getEmail()); } Guid guid = null; String uri = sEntry.getUri(); if (uri!=null) { guid = new Guid(); guid.setPermaLink(false); guid.setValue(uri); } else { String link = sEntry.getLink(); if (link!=null) { guid = new Guid(); guid.setPermaLink(true); guid.setValue(link); } } item.setGuid(guid); return item; }
protected Item createRSSItem(SyndEntry sEntry) { Item item = super.createRSSItem(sEntry); if (sEntry.getAuthors()!=null && sEntry.getAuthors().size() > 0) { SyndPerson author = (SyndPerson)sEntry.getAuthors().get(0); item.setAuthor(author.getEmail()); } Guid guid = null; String uri = sEntry.getUri(); if (uri!=null) { guid = new Guid(); guid.setPermaLink(false); guid.setValue(uri); } else { String link = sEntry.getLink(); if (link!=null) { guid = new Guid(); guid.setPermaLink(true); guid.setValue(link); } } item.setGuid(guid); return item; }
private void buildTableHTML(HtmlBuffer buf, SyndFeed feed){ List entries = feed.getEntries(); if(entries != null){ buf.appendStartTag(HtmlBuffer.TAG_TABLE); for(Iterator i = entries.iterator();i.hasNext();){ SyndEntry entry = (SyndEntry) i.next(); buf.appendStartTag(HtmlBuffer.TAG_TR); buf.appendStartTag(HtmlBuffer.TAG_TD); buf.setNewline(false); buf.appendAnchor(entry.getLink(),entry.getTitle()); buf.setNewline(true); buf.endTag(); if(entry.getPublishedDate() != null){ buf.appendTd(CmsConstants.DATEFORMAT.format(entry.getPublishedDate())); }else{ buf.appendTd(HtmlBuffer.ENTITY_SPACE); } buf.endTag(); buf.appendStartTag(HtmlBuffer.TAG_TR); buf.appendTd(entry.getDescription().getValue(),colmap,false); buf.endTag(); //tr } buf.endTag(); } }
@Override protected Item createRSSItem(SyndEntry sEntry) { Item item = super.createRSSItem(sEntry); if (sEntry.getAuthors()!=null && sEntry.getAuthors().size() > 0) { SyndPerson author = (SyndPerson)sEntry.getAuthors().get(0); item.setAuthor(author.getEmail()); } Guid guid = null; String uri = sEntry.getUri(); if (uri!=null) { guid = new Guid(); guid.setPermaLink(false); guid.setValue(uri); } else { String link = sEntry.getLink(); if (link!=null) { guid = new Guid(); guid.setPermaLink(true); guid.setValue(link); } } item.setGuid(guid); SyndLink comments = sEntry.findRelatedLink("comments"); if(comments != null && (comments.getType() == null || comments.getType().endsWith("html"))){ item.setComments(comments.getHref()); } return item; }
@Override protected Item createRSSItem(SyndEntry sEntry) { Item item = super.createRSSItem(sEntry); if (sEntry.getAuthors()!=null && sEntry.getAuthors().size() > 0) { SyndPerson author = (SyndPerson)sEntry.getAuthors().get(0); item.setAuthor(author.getEmail()); } Guid guid = null; String uri = sEntry.getUri(); if (uri!=null) { guid = new Guid(); guid.setPermaLink(false); guid.setValue(uri); } else { String link = sEntry.getLink(); if (link!=null) { guid = new Guid(); guid.setPermaLink(true); guid.setValue(link); } } item.setGuid(guid); SyndLink comments = sEntry.findRelatedLink("comments"); if(comments != null && (comments.getType() == null || comments.getType().endsWith("html"))){ item.setComments(comments.getHref()); } return item; }