Last active
September 6, 2019 15:31
-
-
Save AndrewPla/5397c72f596233c2c923362d928e6a2c to your computer and use it in GitHub Desktop.
Get-MmaEvent
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-MmaEvent { | |
<# | |
.Description | |
Returns upcoming MMA events from https://www.whenarethefights.com/ | |
#> | |
$request = Invoke-WebRequest -Uri 'https://www.whenarethefights.com/' | |
# Only grab the events that have a countdown. | |
$content = $request.Links.outertext | Where-Object {$_ -like '*days*'} | |
$content | ForEach-Object { | |
$lines = ($_).split([Environment]::NewLine) | Where-Object { $_ -notlike '' } | |
[pscustomobject]@{ | |
Event = $lines[0] | |
Date = $lines[-1] | |
Days = $($lines -like '*days') | |
Hours = $($lines -like '*hours') | |
Minutes = $($lines -like '*minutes') | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment