Click here to Skip to main content
15,560,045 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Most sites has textbox for Comments if you like sometimes when you watch video then bellow the page you can go and put your comments there and able to see other people's comments It and up look like conversation some people even able to through those comments responding others or commenting based to other comments.

So what I am trying to do is to get those comments given the RSS FEED URL for that particular site. or any other way that can help me to achieve my goal.

What I have tried:

import java.util.Iterator;

import com.sun.syndication.feed.synd.SyndEntry;
import com.sun.syndication.feed.synd.SyndFeed;

public class mainclass{
	@SuppressWarnings({ "rawtypes" })
	public static void main(String [] args){
		URL url = new URL("");
		HttpURLConnection httpURLConnection = (HttpURLConnection)url.openConnection();
		httpURLConnection.setRequestProperty("User-Agent", "Mozilla/5.0");
		SyndFeedInput input = new SyndFeedInput();
		SyndFeed feed = null;
	try {
		feed = XmlReader(httpURLConnection));
	} catch (IllegalArgumentException | FeedException e) {
		// TODO Auto-generated catch block
    	//List entries =(List) feed.getEntries();
    	Iterator itEntries = feed.getEntries().iterator();
	 	SyndEntry entry = (SyndEntry);	

	 	System.out.print("TITLE: "+entry.getTitle() +"\n");
	 	System.out.print(entry.getDescription() +"\n");
	catch(MalformedURLException e){		
    catch(IOException e){		
Updated 8-Nov-22 9:18am
Richard Deeming 19-Jul-16 10:00am    
How you do this, and whether you can do this, will vary from site to site.

Looking at the source of the feed you've posted, you'll see elements that look like:
where wfw is the prefix for the namespace "".

You'll need to extract those links, and load the comments from them. Unfortunately, I'm not familiar with the classes you're using, so I can't tell you how you would do that.

Having checked a couple of the links, they don't seem to return any data. I'm not sure whether that means there are no comments, or that the comment feed doesn't work. If it's the latter, then you won't be able to read the comments from the RSS feed.
Member 12642822 19-Jul-16 10:27am    
thank you vary much. May you please give me an examples for that , you can use any language or classes that you are familiar with

1 solution

Use the following regular expression pattern:

Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900