<% Response.Expires = -1 ' =========== RSS2HTML.ASP for ASP/ASP.NET ========== ' copyright 2005-2007 (c) www.Bytescout.com ' version 1.24, 1 October 2007 ' =========== configuration ===================== ' ##### URL to RSS Feed to display ######### URLToRSS = "http://sports.yahoo.com/nhl/rss.xml" ' ##### max number of displayed items ##### MaxNumberOfItems = 25 ' ##### Main template constants MainTemplateHeader = "" MainTemplateFooter = "
" ' ##### ' ###################################### Keyword1 = "Anaheim Ducks" ' Keyword1 = "tech" - set non-empty keyword value to filter by this keyword Keyword2 = "San Jose Sharks" ' Keyword1 = "win" - set non-empty keyword value to filter by this 2nd keyword too Keyword3 = "Los Angeles Kings" ' Keyword1 = "win" - set non-empty keyword value to filter by this 2nd keyword too Keyword4 = "Dallas Stars" ' Keyword1 = "win" - set non-empty keyword value to filter by this 2nd keyword too Keyword5 = "Phoenix Coyotes" ' Keyword1 = "win" - set non-empty keyword value to filter by this 2nd keyword too Keyword6 = "Vancouver Canucks" ' Keyword1 = "win" - set non-empty keyword value to filter by this 2nd keyword too Keyword7 = "Edmonton Oilers" ' Keyword1 = "win" - set non-empty keyword value to filter by this 2nd keyword too Keyword8 = "Calgary Flames" ' Keyword1 = "win" - set non-empty keyword value to filter by this 2nd keyword too Keyword9 = "Colorado Avalanche" ' Keyword1 = "win" - set non-empty keyword value to filter by this 2nd keyword too Keyword10 = "Minnesota Wild" ' Keyword1 = "win" - set non-empty keyword value to filter by this 2nd keyword too Keyword11 = "Louis Blues" ' Keyword1 = "win" - set non-empty keyword value to filter by this 2nd keyword too Keyword12 = "Detroit Red Wings" ' Keyword1 = "win" - set non-empty keyword value to filter by this 2nd keyword too Keyword13 = "Nashville Predators" ' Keyword1 = "win" - set non-empty keyword value to filter by this 2nd keyword too Keyword14 = "Chicago Blackhawks" ' Keyword1 = "win" - set non-empty keyword value to filter by this 2nd keyword too Keyword15 = "Columbus Blue Jackets" ' Keyword1 = "win" - set non-empty keyword value to filter by this 2nd keyword too Keyword16 = "Boston Bruins" ' Keyword1 = "win" - set non-empty keyword value to filter by this 2nd keyword too Keyword17 = "New York Rangers" ' Keyword1 = "win" - set non-empty keyword value to filter by this 2nd keyword too Keyword18 = "New York Islanders" ' Keyword1 = "win" - set non-empty keyword value to filter by this 2nd keyword too Keyword19 = "Ottawa Senators" ' Keyword1 = "win" - set non-empty keyword value to filter by this 2nd keyword too Keyword20 = "Montreal Canadiens" ' Keyword1 = "win" - set non-empty keyword value to filter by this 2nd keyword too Keyword21 = "Florida Panthers" ' Keyword1 = "win" - set non-empty keyword value to filter by this 2nd keyword too Keyword22 = "Washington Capitols" ' Keyword1 = "win" - set non-empty keyword value to filter by this 2nd keyword too Keyword23 = "Carolina Hurricanes" ' Keyword1 = "win" - set non-empty keyword value to filter by this 2nd keyword too Keyword24 = "Tampa Bay Lightning" ' Keyword1 = "win" - set non-empty keyword value to filter by this 2nd keyword too Keyword25 = "Buffalo Sabres" ' Keyword1 = "win" - set non-empty keyword value to filter by this 2nd keyword too Keyword26 = "Atlanta Thrahers" ' Keyword1 = "win" - set non-empty keyword value to filter by this 2nd keyword too Keyword27 = "Philadelphia Flyers" ' Keyword1 = "win" - set non-empty keyword value to filter by this 2nd keyword too Keyword28 = "New Jersey Devils" ' Keyword1 = "win" - set non-empty keyword value to filter by this 2nd keyword too Keyword29 = "Pittsburgh Penguins" ' Keyword1 = "win" - set non-empty keyword value to filter by this 2nd keyword too Keyword30 = "Toronto Maple Leafs" ' Keyword1 = "win" - set non-empty keyword value to filter by this 2nd keyword too Keyword31 = "" ' Keyword1 = "win" - set non-empty keyword value to filter by this 2nd keyword too ' ################################# ' ##### Item template. ' ##### {LINK} will be replaced with item link ' ##### {TITLE} will be replaced with item title ' ##### {DESCRIPTION} will be replaced with item description ' ##### {DATE} will be replaced with item date and time ' ##### {COMMENTSLINK} will be replaced with link to comments (if you use RSS feed from blog) ' ##### {CATEGORY} will be replaced with item category ItemTemplate = "{DATE}
{CATEGORY}{TITLE}
{DESCRIPTION}
" ' ##### Error message that will be displayed if not items etc ErrorMessage = "Error has occured while trying to process " &URLToRSS & "
Please contact web-master" ' ================================================ Set xmlHttp = Server.CreateObject("MSXML2.ServerXMLHTTP.3.0") xmlHttp.Open "Get", URLToRSS, false xmlHttp.Send() RSSXML = xmlHttp.ResponseText Set xmlDOM = Server.CreateObject("MSXML2.DomDocument.3.0") xmlDOM.async = False xmlDOM.validateOnParse = False xmlDom.resolveExternals = False If not xmlDOM.LoadXml(RSSXML) Then ErrorMessage = "Can not load XML:" & vbCRLF & xmlDOM.parseError.reason & vbCRLF & ErrorMessage End If Set xmlHttp = Nothing ' clear HTTP object Set RSSItems = xmlDOM.getElementsByTagName("item") ' collect all "items" from downloaded RSS RSSItemsCount = RSSItems.Length-1 ' if not .. entries, then try to get .. if RSSItemsCount = -1 Then Set RSSItems = xmlDOM.getElementsByTagName("entry") ' collect all "entry" (atom format) from downloaded RSS RSSItemsCount = RSSItems.Length-1 End If Set xmlDOM = Nothing ' clear XML ' writing Header if RSSItemsCount > 0 then Response.Write "News provided via RSS feed from Yahoo! Sports

" End If j = -1 For i = 0 To RSSItemsCount Set RSSItem = RSSItems.Item(i) for each child in RSSItem.childNodes Select case lcase(child.nodeName) case "title" RSStitle = child.text case "link" If RSSLink = "" Then If child.Attributes.length>0 Then RSSLink = child.GetAttribute("href") if (RSSLink <> "") Then if child.GetAttribute("rel") <> "alternate" Then RSSLink = "" End If End If End If ' if has attributes If RSSLink = "" Then RSSlink = child.text End If End If case "description" RSSdescription = child.text case "content" ' atom format RSSdescription = child.text case "published"' atom format RSSDate = child.text case "pubdate" RSSDate = child.text case "comments" RSSCommentsLink = child.text case "category" Set CategoryItems = RSSItem.getElementsByTagName("category") RSSCategory = "" for each categoryitem in CategoryItems if RSSCategory <> "" Then RSSCategory = RSSCategory & ", " End If RSSCategory = RSSCategory & categoryitem.text Next End Select next ' now check filter If (InStr(RSSTitle,Keyword31)>0) or (InStr(RSSDescription,Keyword31)>0) then 'If (InStr(RSSTitle,Keyword1)>0) or (InStr(RSSDescription,Keyword1)>0) or (InStr(RSSTitle,Keyword2)>0) or (InStr(RSSDescription,Keyword2)>0) or (InStr(RSSTitle,Keyword3)>0) or (InStr(RSSDescription,Keyword3)>0) or (InStr(RSSTitle,Keyword4)>0) or (InStr(RSSDescription,Keyword4)>0) or (InStr(RSSTitle,Keyword5)>0) or (InStr(RSSDescription,Keyword5)>0) or (InStr(RSSTitle,Keyword6)>0) or (InStr(RSSDescription,Keyword6)>0) or (InStr(RSSTitle,Keyword7)>0) or (InStr(RSSDescription,Keyword7)>0) or (InStr(RSSTitle,Keyword8)>0) or (InStr(RSSDescription,Keyword8)>0) or (InStr(RSSTitle,Keyword9)>0) or (InStr(RSSDescription,Keyword9)>0) or (InStr(RSSTitle,Keyword10)>0) or (InStr(RSSDescription,Keyword10)>0) or (InStr(RSSTitle,Keyword11)>0) or (InStr(RSSDescription,Keyword11)>0) or (InStr(RSSTitle,Keyword12)>0) or (InStr(RSSDescription,Keyword12)>0) or (InStr(RSSTitle,Keyword13)>0) or (InStr(RSSDescription,Keyword13)>0) or (InStr(RSSTitle,Keyword14)>0) or (InStr(RSSDescription,Keyword14)>0) or (InStr(RSSTitle,Keyword15)>0) or (InStr(RSSDescription,Keyword15)>0) or (InStr(RSSTitle,Keyword16)>0) or (InStr(RSSDescription,Keyword16)>0) or (InStr(RSSTitle,Keyword17)>0) or (InStr(RSSDescription,Keyword17)>0) or (InStr(RSSTitle,Keyword18)>0) or (InStr(RSSDescription,Keyword18)>0) or (InStr(RSSTitle,Keyword19)>0) or (InStr(RSSDescription,Keyword19)>0) or (InStr(RSSTitle,Keyword20)>0) or (InStr(RSSDescription,Keyword20)>0) or (InStr(RSSTitle,Keyword21)>0) or (InStr(RSSDescription,Keyword21)>0) or (InStr(RSSTitle,Keyword22)>0) or (InStr(RSSDescription,Keyword22)>0) or (InStr(RSSTitle,Keyword23)>0) or (InStr(RSSDescription,Keyword23)>0) or (InStr(RSSTitle,Keyword24)>0) or (InStr(RSSDescription,Keyword24)>0) or (InStr(RSSTitle,Keyword25)>0) or (InStr(RSSDescription,Keyword25)>0) or (InStr(RSSTitle,Keyword26)>0) or (InStr(RSSDescription,Keyword26)>0) or (InStr(RSSTitle,Keyword27)>0) or (InStr(RSSDescription,Keyword27)>0) or (InStr(RSSTitle,Keyword28)>0) or (InStr(RSSDescription,Keyword28)>0) or (InStr(RSSTitle,Keyword29)>0) or (InStr(RSSDescription,Keyword29)>0) or (InStr(RSSTitle,Keyword30)>0) or (InStr(RSSDescription,Keyword30)>0) then j = J+1 if J" ItemContent = "" RSSLink = "" End if End If Next ' writing Footer if RSSItemsCount > 0 then Response.Write MainTemplateFooter else Response.Write ErrorMessage End If ' Response.End ' uncomment this for use in on-the-fly output %>