Public Sub TestAPIGetRSS
' Dim BaseURL As String = "https://ims.gov.il/sites/default/files/ims_data/rss/alert/rssAlert_general_country_he.xml"
Dim BaseURL As String = "http://www.ynet.co.il/Integration/StoryRss2.xml"
Wait For (APIGetRSS(BaseURL)) Complete (Result As String)
If Result.Length = 0 Then Return
Dim XML As Xml2Map
XML.Initialize
Dim ParsedData As Map = XML.Parse(Result)
TextArea1.Text = ParsedData.As(JSON).ToString
Dim parser As JSONParser
parser.Initialize(TextArea1.Text)
Dim mRoot As Map = parser.NextObject
Dim rss As Map = mRoot.Get("rss")
' Dim Attributes As Map = rss.Get("Attributes")
' Dim version As String = Attributes.Get("version")
Dim channel As Map = rss.Get("channel")
' Dim image As Map = channel.Get("image")
' Dim link As String = image.Get("link")
' Dim title As String = image.Get("title")
' Dim url As String = image.Get("url")
' Dim copyright As String = channel.Get("copyright")
' Dim lastBuildDate As String = channel.Get("lastBuildDate")
' Dim link As String = channel.Get("link")
' Dim description As String = channel.Get("description")
' Dim language As String = channel.Get("language")
' Dim title As String = channel.Get("title")
' Dim pubDate As String = channel.Get("pubDate")
Dim item As List = channel.Get("item")
For Each colitem As Map In item
' Dim link As String = colitem.Get("link")
' Log(link)
Dim description As String = colitem.Get("description")
Log(description)
Dim Matcher2 As Matcher = Regex.Matcher("(http[^\s]+(jpg|jpeg|png|tiff)\b)", description) 'Get Url Image
If Matcher2.Find Then Log(Matcher2.Match) 'Get Url Image
Log(Regex.Replace("<(.|\n)*?>", description, "")) 'Delete Tag Html and Get descripcion
' Dim guid As String = colitem.Get("guid")
' Log(guid)
' Dim title As String = colitem.Get("title")
' Log(title)
' Dim pubDate As String = colitem.Get("pubDate")
' Log(pubDate)
' Dim tags As String = colitem.Get("tags")
' Log(tags)
Log("--------------------" & CRLF)
Next
End Sub
Public Sub APIGetRSS(URL As String) As ResumableSub
Dim ResultURL As String
Dim j As HttpJob
Try
j.Initialize("", Me)
j.Download(URL)
Wait For (j) JobDone(j As HttpJob)
If j.Success Then
ResultURL = j.GetString
End If
Catch
Log(LastException.Message)
End Try
j.Release
Return ResultURL
End Sub