Get info from a websites source
Website source:
HTML Code:
Some random content
<div id="right" class="column">
<div class="pane">
<div class="pane_header"><h2>Site News & Events</h2></div>
<div class="pane_content">
<div id="news_feed">
<div class='news_post'>
<p class="news_post_topic"><a href="/example" title="example</a><br/>
Posted <abbr class='timeago' title='2013-05-21 16:28:07'>05/21/2013</abbr></p>
</div>
<div class='news_post'>
<p class="news_post_topic"><a href="/example2" title="examples">/example</a><br/>
Posted <abbr class='timeago' title='2013-05-10 16:53:37'>05/10/2013</abbr></p>
</div>
</div>
</div>
.....
Some more content
What i want:
Without any webbrowser window,(using webclient), search in all the code.
Find the id news_feed, and go to the first child, and get the websitelink, the title, and the date posted.
Then display the title, with the websitelink on a linklabel, and the dateposted on the label.
Then do the same foe the next news_post.
I believed it would look something like this, but i was wrong
WebBrowser1.Document.GetElementById("news_feed").AppendChild(1) ...[On this example i used webbrowser. I want it without it;) ]
Re: Get info from a websites source
If you did some Bing/Google searches, you would have probably found the Html Agility Pack which will do exactly what you need.
Re: Get info from a websites source
Aaargh! Not the Agility Pack! Anything but the Agility Pack! :eek:
Re: Get info from a websites source
Quote:
Originally Posted by
formlesstree4
If you did some Bing/Google searches, you would have probably found the
Html Agility Pack which will do exactly what you need.
Thanks alot, i will see what i can do
Re: Get info from a websites source
Quote:
Originally Posted by
dunfiddlin
Aaargh! Not the Agility Pack! Anything but the Agility Pack! :eek:
Why not? What should i use? Do you recommend something? Thanks alot for the help:)
Kind regards
Re: Get info from a websites source
It's just not necessary. It's simpler (and requires no additives!) to continue using a webbrowser object, just behind the scenes. It's not necessary to make the browser visible or for the user to be in any way aware of it. It's simply a host for the HTML document (which is ultimately all the Agility Pack is, after all!)
Re: Get info from a websites source
Quote:
Originally Posted by
dunfiddlin
It's just not necessary. It's simpler (and requires no additives!) to continue using a webbrowser object, just behind the scenes. It's not necessary to make the browser visible or for the user to be in any way aware of it. It's simply a host for the HTML document (which is ultimately all the Agility Pack is, after all!)
His criteria was to not use it! :p
Had he not said that, I would have just said use the WebBrowser. Who are we to say to the OP that he should use the phillips head screw driver on a phillips screw when the flat head clearly works :D
EDIT: He could EVEN use mshtml and reference the HtmlDocument class there!! :D
Re: Get info from a websites source
Quote:
His criteria was to not use it!
You've got to read between the lines sometimes! What he said was not to use it, what I think he meant was not to show that he was using it! Could be wrong. It happens. There was that occasion in 1974 when ...
Re: Get info from a websites source
Quote:
Originally Posted by
dunfiddlin
You've got to read between the lines sometimes! What he said was not to use it, what I think he meant was not to show that he was using it! Could be wrong. It happens. There was that occasion in 1974 when ...
formlesstree4 pulls up a chair
...go on
Re: Get info from a websites source
Quote:
Originally Posted by
dunfiddlin
You've got to read between the lines sometimes! What he said was not to use it, what I think he meant was not to show that he was using it! Could be wrong. It happens. There was that occasion in 1974 when ...
Well i meant, you know how it is this..
Dim str As String = New WebClient().DownloadString(("http://downforeveryoneorjustme.com/planetminecraft.com"))
something like that, not a webbrowser, it doesn't use gui.
But anyways, i need though help with the childs. how to get the correct id, and each child.
Re: Get info from a websites source
Quote:
Originally Posted by
vasil7112
Well i meant, you know how it is this..
Dim str As String = New WebClient().DownloadString(("http://downforeveryoneorjustme.com/planetminecraft.com"))
something like that, not a webbrowser, it doesn't use gui.
But anyways, i need though help with the childs. how to get the correct id, and each child.
You don't even need to SHOW the WebBrowser. You can make an instance of it because, at its heart, it's still an object. So just create a WebBrowser and load it up.
Re: Get info from a websites source
Quote:
Originally Posted by
formlesstree4
You don't even need to SHOW the WebBrowser. You can make an instance of it because, at its heart, it's still an object. So just create a WebBrowser and load it up.
Ok, another question. if instead of id, it was class, how can i do it?
Re: Get info from a websites source
It's amazing what using a search engine will uncover!