How can I best go about approaching this issue of extracting URL links from an RSS feed?

I googled a lot before landing here but I can’t find anything that answers my question.

I essentially I want use my windows file manager to browse the latest RSS feeds as URL links that I can open in my own browser. I have my own competent file manager that will label, sort and automate the URL files and have a browser that will display pages exactly how I need them displayed.

can I do it with PowerShell?

To me, there does not seem to be more to it than getting latest RSS Feed and outputting them as individual URL files to a directory. Where I may have an issue is determining where the latest feed threshold would be, so I am not recreating duplicate URL/Old Articles

Any insight and potential pitfalls into this would be really appreciated. Thank you.

Tim,
Welcome to the forum. :wave:t4:

I’d say probably … but after reading your explanation twice I’m still unsure what this task would actually be about. :wink:

You may split it in separate sub tasks and try to solve it one by one. What would be the first step?

1 Like

Thank you for the kind Hospitality, Olaf.

I’d say probably … but after reading your explanation twice I’m still unsure what this task would actually be about.

Pardon me. I will give it a second go.

I essentially want a functionality(Achieved through PowerShell) that will go through an RSS link and save the latest articles as .URL files on a given directory. Allowing me to open these links just as any .URL files.

From my limited understanding an RSS amongst other things, consists of a Title and a Link per article.

So if I for example run $feed = Invoke-RestMethod https://www.muddycolors.com/feed/ and then after that $feed | Format-Table -Property Title, Link I get something like this.

I though generating a .URL file using the Link property as the address and the Title property as the name of the .URL to be generated. So far I have something like the snippet below

$feed = Invoke-RestMethod https://www.muddycolors.com/feed/
$feed | ForEach-Object{
    $Shell = New-Object -ComObject ("WScript.Shell")
    $Favorite = $Shell.CreateShortcut("C:\temp\$PSItem.Title.".URL)
    $Favorite.TargetPath = "$PSItem.Link"
    $Favorite.Save()
}

It does not work. I have tested the $Shell = New-Object -ComObject ("WScript.Shell") and have used it to create a single .URL file but using it in loops is beyond me.

I am trying to see what would be a good way to manage this long term. it seems straight forward to come up a solution for a single website but what about 10 websites? or 30!.

I have been searching the web and unable to find anything that says if can use powershell for automation of GUI application. When you can select fields and write to fields in the GUI. If not any ideas on what we could use. Any help would be appreciated.

Julie,

Welcome to the forum. :wave:t4:

Please do not hijack other peoples threads. Instead create a new one for yourself and if needed place a link to the other thread if needed. :wink: In this case it doesm’t even fit to the question of the original question. :face_with_raised_eyebrow:

Even if it may be possible PowerShell is not made for such tasks. But there are scripting language particularely invented for those scenarios. You may take a look at

and
https://www.autohotkey.com

Both have been actually invented to be able to automate installations not intended to be automated. :wink:

Because you’re accessing properties of $PSItem, you need to use the subexpression operator $().

Try it like this:

$feed | ForEach-Object{
    $Shell = New-Object -ComObject WScript.Shell
    $Favorite = $Shell.CreateShortcut("E:\Temp\Files\$($PSItem.Title).URL")
    $Favorite.TargetPath = "$($PSItem.Link)"
    $Favorite.Save()
}
1 Like

Please do not post pictures of code or console output or sample data. Instead post the text and format it as code just like you did it with your code.

Thanks in advance.

You’ve been actually close. But …

… is a really bad explanation what’s not working. You should be more descriptive and if you get errors you should post the complete error message as well … formatted as code as well.

Because there are some charachters in the title unsuitable for file names we have to remove those charachters first.

$FeedList = Invoke-RestMethod "https://www.muddycolors.com/feed/"
$wshshell = New-Object -ComObject WScript.Shell
foreach($feed in $FeedList){
    $CleanedTitle = $feed.title -replace '\?|\:'
    $LinkFile = Join-Path -Path 'C:\sample\empty'  -ChildPath ($CleanedTitle + ".url")
    $lnk = $wshshell.CreateShortcut($LinkFile)
    $lnk.TargetPath = $feed.link
    $lnk.Save()
}

It’s enough to create the shell object once. So you just place it outside the loop.

2 Likes

Very new to this but what you say makes sense. I will do so going forward.

I had no anticipated this. Article names can contain question marks!
Your example looks really nice. I look forward to trying it out myself! thanks allot for helping me, to the both of you.