Extract content from html body


#1

Hi everybody!
I’m building app for read news. I want extract only the content of the news, but when I try, I can’t. I use htmlString.replace and other things, but this approach doesn’t works for all the sites.

Anyone needed the same?

thank you very much!!
armando


#2

Your question is too ambiguous to understand, please always provide code you’ve tried and describe whats the result of that and what you are actually looking for.

In general though, what I feel is you should learn more about “Template reference variables” and the @ViewChild, @ContentChild, @ViewChildren and @ContentChildren decorators. I’d suggest you not to manipulate the DOM directly either, if possible.


#3

I don’t see how this is even remotely Ionic-related.


#4

Perhaps you should look to create an RSS reader ionic app?


#5

Well, we are pretty liberal about that here. If it ends up in an Ionic app, we can talk about it.

@armandof Can you provide an example what you are already doing? Using an RSS feed or an external service to do the parsing (http://feed43.com/ is old but works great!) might be a good idea.


#6

As I understand the question, it is about how to write a scraper. I believe that is a rather elaborate topic that is best addressed away from a device.

Apologies for inappropriate phrasing, but I think OP would be best served dealing with this on a server and not having an on-device Ionic app be concerned with any of this whatsoever.


#7

yes @KishuPro thanks!


#8

Hi @Sujan12 thank you for your response. The idea is that each user can select him favourite feed source, like this app https://itunes.apple.com/us/app/fews-local-daily-news-latest-world-news/id984476711?mt=8

I don’t wanna work with server; just in the app with the scrapping method. What do you think?

Thank you very much!


#9

Not a good idea. Besides the possible legal problems that I won’t discuss, you have to know yourself what you are doing, sites change. So every time one of the sites breaks you would have to push an update to all your users. Much easier to just change something in the backend to make it work again.


#10

ok, good to know! thank you!!