Skip to content

Instantly share code, notes, and snippets.

@cakriwut
Created October 5, 2016 15:26
Show Gist options
  • Save cakriwut/e3c213a49082f835292dcfb87d923930 to your computer and use it in GitHub Desktop.
Save cakriwut/e3c213a49082f835292dcfb87d923930 to your computer and use it in GitHub Desktop.
How to download URL news link from detik.com using RSS feed
# Defines file capture location
$fileCapture = "C:\temp\detik.txt"
# List of target RSS - you can add more
$targetRSS = "detikcom_nasional", "detikcom_internasional", "detikcom_bbc","detikcom_lapsus","detikcom_wawancara"," detikcom_prokontra"
$targetRSS |% {
$url = "http://rss.detik.com/index.php/" + $_
$targetXml = "C:\temp\" + $_ + ".xml"
Invoke-WebRequest -Uri $url -OutFile $targetXml -ErrorAction Stop
[xml]$Content = gc $targetXml
$Feed = $Content.rss.channel
$Feed.Item |% {
$msg = $_
Add-Content $detikLink $msg.link
}
# Clean-up temporary file
Remove-Item $targetXml -Force -ErrorAction Ignore
}
@cakriwut
Copy link
Author

cakriwut commented Oct 5, 2016

I document consuming detik.com RSS feeds and extract URL links. This method is not preferable. Use DetikApi.ps1 instead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment