i want to make a app which show the result of my university now how can i get the data from my university website ?Is there any way to do that ?please help
You’ll need to use Http requests to fetch data, as a general response.
I think what you are referring to by saying ‘from DOM’ is your university website does not have any API support. In that case, all you can do is ‘screen scrape’ - that is do an HTTP GET on the web page and parse its contents to extract data.
Notes: (assuming you plan to screen scrape)
- Remember that if you do parse the web page, any small change they do may break your code
- If you must screen scrape, use a forgiving parser (that is, most websites will have HTML coding errors, don’t use a parser that borks for every small transgression)
- There are intermediary services that parse website and expose APIs to you - I’ve never tried them
- Try not to use regex (actually, this is true only if you are trying to do complex tag matching. I find regex to be ideal if I’m just globbing for very specific data and not trying to match tag start/ends)
how can i use forgiving parser in angular two i am getting error could you help me ?
how should i import it after installing it ?
Actually that link was just an example - if it doesn’t have typescript bindings, you’ll have to import it in index.html and declare it in your ts code.
There are other options too like DOMParser https://developer.mozilla.org/en-US/docs/Web/API/DOMParser
There is also parse5 - I’ve heard many good things - haven’t used it
You’ll have to experiment - on what works best for you. I’ve used DOMParser in the past and it worked for me.