Home > Uncategorized > How To Retrieve The Name And Links Of Every Entry In A RSS Feed?

How To Retrieve The Name And Links Of Every Entry In A RSS Feed?

December 16th, 2009 Angel Leave a comment Go to comments

Description

Rss is becoming more and more popular to share all kind of information. For example this blog has a rss feed that can be found in the following link:

http://www.discoveryourpc.net/feeds/posts/default

I need many times the link of a post so I have to go to my website and navigate it .

Solution

We are going to use Visual Basic Script that come by default in Windows to process the feed and wget to retrieve it.

Let begin.

1. We download wget to c:\utils:

http://users.ugent.be/~bpuype/wget/

2. We save the feed in a file. 

a. Press Windows Key + R, type cmd and press enter.

b. In the windows command, type cd /D c:\utils and press enter.

c. Type:

wget -O rss.xml http://www.discoveryourpc.net/feeds/posts/default?format=xml

and press enter.

A new file rss.xml will appear.

3. Now we are going to use a Visual Basic Script, so we need to create it. Open notepad, press Windows Key + R, type notepad and press enter. Copy the following code:

Dim objFSO
pattern = "<title type=’text’>([^<]+)</title>|<link rel=’alternate’ type=’text/html’ href=’([^’]+)’ title"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set file = objFSO.OpenTextFile("c:\\utils\\rss.xml", 1 )
line=""
While not file.AtEndOfStream

line=line & file.ReadLine

Wend
Set procesNameUrl = New RegExp
procesNameUrl.IgnoreCase = True
procesNameUrl.Global = True
procesNameUrl.pattern = pattern
Set matches = procesNameUrl.Execute( line )
For Each match In matches

If match.Submatches(0)<> "" Then
    WScript.Echo match.Submatches(0) 
End If
If match.Submatches(1)<> "" Then
    WScript.Echo match.Submatches(1) 
End If

Next

And save it to “processFeed.vbs” don’t forget the quotes so notepad save it as a Visual Basic Script file.

As you can see what this program does is look for the title entry and the link. Regular expressions are a useful tool when you need to process a file.

4. Execute it:

To execute it go to c:\utils folder and type:

cscript processFeed.vbs

Related posts:

  1. How To Know That A Web Page Has Changed
  2. How To Execute A Program With Other User Not Showing The Password
  3. Open Button Doesn’t Appear Using Hotmail Links
  4. How To Know The Number Of New Messages In Gmail Using The Command Line
  5. Is There A New Program On My Start?
Categories: Uncategorized Tags:
  1. No comments yet.
  1. No trackbacks yet.