jhylands

Get bbc news

Jan 3rd, 2012
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 2.92 KB | None | 0 0
  1.     Public Structure story
  2.         Dim title As String
  3.         Dim description As String
  4.         Dim url As String
  5.     End Structure 'This stores a news story from bbc or facebook
  6.     Dim today(59) As story
  7.     Public Sub bbcnews(byref today as story)
  8.         Dim allnews As String
  9.         Dim request As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create("http://feeds.bbci.co.uk/news/business/rss.xml")
  10.         Dim response As System.Net.HttpWebResponse = request.GetResponse()
  11.         Dim sr As New System.IO.StreamReader(response.GetResponseStream)
  12.         allnews = sr.ReadToEnd
  13.         For i = 0 To 19
  14.             allnews = Mid(allnews, InStr(allnews, "<item>") + 6, Len(allnews) - InStr(allnews, "<item>") - 6)
  15.             today(i).title = Mid(allnews, InStr(allnews, "<title>") + 7, InStr(allnews, "</title>") - InStr(allnews, "<title>") - 7)
  16.             today(i).description = Mid(allnews, InStr(allnews, "<description>") + 13, InStr(allnews, "</description>") - InStr(allnews, "<description>") - 13)
  17.             today(i).url = Mid(allnews, InStr(allnews, "<link>") + 6, InStr(allnews, "</link>") - InStr(allnews, "<link>") - 6)
  18.  
  19.         Next
  20.         '----------------------------------------------------------------
  21.         request = System.Net.HttpWebRequest.Create("http://feeds.bbci.co.uk/news/technology/rss.xml")
  22.         response = request.GetResponse()
  23.         sr = New System.IO.StreamReader(response.GetResponseStream)
  24.         allnews = sr.ReadToEnd
  25.         For i = 20 To 39
  26.             allnews = Mid(allnews, InStr(allnews, "<item>") + 6, Len(allnews) - InStr(allnews, "<item>") - 6)
  27.             today(i).title = Mid(allnews, InStr(allnews, "<title>") + 7, InStr(allnews, "</title>") - InStr(allnews, "<title>") - 7)
  28.             today(i).description = Mid(allnews, InStr(allnews, "<description>") + 13, InStr(allnews, "</description>") - InStr(allnews, "<description>") - 13)
  29.             today(i).url = Mid(allnews, InStr(allnews, "<link>") + 6, InStr(allnews, "</link>") - InStr(allnews, "<link>") - 6)
  30.         Next
  31.         '----------------------------------------------------------------
  32.         request = System.Net.HttpWebRequest.Create("http://feeds.bbci.co.uk/news/science_and_environment/rss.xml")
  33.         response = request.GetResponse()
  34.         sr = New System.IO.StreamReader(response.GetResponseStream)
  35.         allnews = sr.ReadToEnd
  36.         For i = 40 To 59
  37.             allnews = Mid(allnews, InStr(allnews, "<item>") + 6, Len(allnews) - InStr(allnews, "<item>") - 6)
  38.             today(i).title = Mid(allnews, InStr(allnews, "<title>") + 7, InStr(allnews, "</title>") - InStr(allnews, "<title>") - 7)
  39.             today(i).description = Mid(allnews, InStr(allnews, "<description>") + 13, InStr(allnews, "</description>") - InStr(allnews, "<description>") - 13)
  40.             today(i).url = Mid(allnews, InStr(allnews, "<link>") + 6, InStr(allnews, "</link>") - InStr(allnews, "<link>") - 6)
  41.         Next
  42.     End Sub
Advertisement
Add Comment
Please, Sign In to add comment