mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-02-02 19:09:13 +01:00
Renamed to list-news.ps1
This commit is contained in:
parent
66bc6a7699
commit
3b87b47a3b
@ -30,8 +30,9 @@ The following PowerShell scripts can be found in the [Scripts/](Scripts/) subfol
|
|||||||
* [list-logbook.ps1](Scripts/list-logbook.ps1) - lists the content of the logbook
|
* [list-logbook.ps1](Scripts/list-logbook.ps1) - lists the content of the logbook
|
||||||
* [list-unused-files.ps1](Scripts/list-unused-files.ps1) - lists unused files in a directory tree
|
* [list-unused-files.ps1](Scripts/list-unused-files.ps1) - lists unused files in a directory tree
|
||||||
* [list-cmdlets.ps1](Scripts/list-cmdlets.ps1) - lists the PowerShell cmdlets
|
* [list-cmdlets.ps1](Scripts/list-cmdlets.ps1) - lists the PowerShell cmdlets
|
||||||
* [list-earthquakes.ps1](Scripts/list-earthquakes.ps1) - lists earthquakes >= 6.0 for the last 30 days
|
* [list-earthquakes.ps1](Scripts/list-earthquakes.ps1) - lists earthquakes with magnitude >= 6.0 for the last 30 days
|
||||||
* [list-modules.ps1](Scripts/list-modules.ps1) - lists the PowerShell modules
|
* [list-modules.ps1](Scripts/list-modules.ps1) - lists the PowerShell modules
|
||||||
|
* [list-news.ps1](Scripts/list-news.ps1) - lists the latest news
|
||||||
* [list-random-passwords.ps1](Scripts/list-random-passwords.ps1) - prints a list of random passwords
|
* [list-random-passwords.ps1](Scripts/list-random-passwords.ps1) - prints a list of random passwords
|
||||||
* [list-random-pins.ps1](Scripts/list-random-pins.ps1) - prints a list of random PIN's
|
* [list-random-pins.ps1](Scripts/list-random-pins.ps1) - prints a list of random PIN's
|
||||||
* [list-processes.ps1](Scripts/list-processes.ps1) - lists the local computer processes
|
* [list-processes.ps1](Scripts/list-processes.ps1) - lists the local computer processes
|
||||||
@ -47,7 +48,6 @@ The following PowerShell scripts can be found in the [Scripts/](Scripts/) subfol
|
|||||||
* [play-beep.ps1](Scripts/play-beep.ps1) - plays a beep sound
|
* [play-beep.ps1](Scripts/play-beep.ps1) - plays a beep sound
|
||||||
* [poweroff.ps1](Scripts/poweroff.ps1) - halts the local computer (needs administrator rights)
|
* [poweroff.ps1](Scripts/poweroff.ps1) - halts the local computer (needs administrator rights)
|
||||||
* [new-email.ps1](Scripts/new-email.ps1) - starts the default email client to write a new email
|
* [new-email.ps1](Scripts/new-email.ps1) - starts the default email client to write a new email
|
||||||
* [news.ps1](Scripts/news.ps1) - prints the latest news
|
|
||||||
* [reboot.ps1](Scripts/reboot.ps1) - reboots the local computer (needs administrator rights)
|
* [reboot.ps1](Scripts/reboot.ps1) - reboots the local computer (needs administrator rights)
|
||||||
* [search-files.ps1](Scripts/search-files.ps1) - searches the given pattern in the given files
|
* [search-files.ps1](Scripts/search-files.ps1) - searches the given pattern in the given files
|
||||||
* [scan-ports.ps1](Scripts/scan-ports.ps1) - scans the network for open/closed ports
|
* [scan-ports.ps1](Scripts/scan-ports.ps1) - scans the network for open/closed ports
|
||||||
|
25
Scripts/list-news.ps1
Executable file
25
Scripts/list-news.ps1
Executable file
@ -0,0 +1,25 @@
|
|||||||
|
#!/snap/bin/powershell
|
||||||
|
<#
|
||||||
|
.SYNTAX ./list-news.ps1 [<RSS-URL>]
|
||||||
|
.DESCRIPTION lists the latest news
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
param([string]$RSS_URL = "https://yahoo.com/news/rss/world")
|
||||||
|
|
||||||
|
try {
|
||||||
|
[xml]$Content = (invoke-webRequest -URI $RSS_URL).Content
|
||||||
|
|
||||||
|
write-output ""
|
||||||
|
write-output "+++ $($Content.rss.channel.title) +++"
|
||||||
|
write-output ""
|
||||||
|
|
||||||
|
foreach ($item in $Content.rss.channel.item) {
|
||||||
|
write-output "* $($item.title)"
|
||||||
|
}
|
||||||
|
exit 0
|
||||||
|
} catch {
|
||||||
|
write-error "ERROR in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
exit 1
|
||||||
|
}
|
@ -1,27 +0,0 @@
|
|||||||
#!/snap/bin/powershell
|
|
||||||
<#
|
|
||||||
.SYNTAX ./news.ps1
|
|
||||||
.DESCRIPTION print the latest news
|
|
||||||
.LINK https://github.com/fleschutz/PowerShell
|
|
||||||
.NOTES Author: Markus Fleschutz / License: CC0
|
|
||||||
#>
|
|
||||||
|
|
||||||
#$RSS_URL = "http://feeds.skynews.com/feeds/rss/world.xml"
|
|
||||||
$RSS_URL = "https://yahoo.com/news/rss/world"
|
|
||||||
# $RSS_URL = "https://rss.nytimes.com/services/xml/rss/nyt/HomePage.xml"
|
|
||||||
|
|
||||||
try {
|
|
||||||
[xml]$FileContent = (Invoke-WebRequest -Uri $RSS_URL).Content
|
|
||||||
|
|
||||||
write-output ""
|
|
||||||
write-output "+++ $($FileContent.rss.channel.title) +++"
|
|
||||||
write-output ""
|
|
||||||
|
|
||||||
foreach ($item in $FileContent.rss.channel.item) {
|
|
||||||
write-output "* $($item.title)"
|
|
||||||
}
|
|
||||||
exit 0
|
|
||||||
} catch {
|
|
||||||
write-error "ERROR in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
|
||||||
exit 1
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user