- Latest Posts & Videos, All Posts, and All Videos are served from the CONTENT DATABASE, based on a few properties:
- Type: Post or Video plus Feature As a Feature post or video, it also serves to the home page as a Latest Post or Latest Video. Consider only having 1-3 Feature at a time to avoid cluttering the page.
- Status: Live - a post or video marked as Draft will not serve to this page or the home page.
- Type: Post or Video
- Status: Live
- Make sure to replace the text in the properties: Title, Excerpt, and Published Date so Post display correctly like this:
When I began using PowerShell I recall seeing some awesome stuff being done with
Invoke-WebRequest. After seeing the output of
Invoke-WebRequest I quickly became overwhelmed and moved onto a different task. The output may seem a bit overwhelming at first, but once you know what to look for it starts to become more manageable.
Our goal is to create a function that will query whenarethefights.com. I love watching MMA events, and I rarely miss a UFC event. There are also events by other promotions that I don’t want to miss. Hopefully the function that we create will help me ensure that I’m aware of all upcoming events, without having to leave my favorite console!
Invoke-WebRequest is a command that will send a web request and output the parsed results. Your browser sends web requests and renders the html that is returned. We don’t have the benefit of being able to render html in PowerShell, so we have to be creative.
Sending a Web Request
Invoke-WebRequest -Uri 'https://www.whenarethefights.com/'
The output contains several properties that have been created for us. These include Statuscode, StatusDescription, Content, RawContent, Forms, Headers, Images, InputFields, and Links. We are interested in the Links property.
Parsing the Web Request
$request = Invoke-WebRequest -Uri 'https://www.whenarethefights.com'
# view the 1st link
LFA 75: Lamson vs. Estr?zulas
Sat Sep 7th 9:00:00 PM EDT
It looks like all of the relevant information is there.
Now all that’s left is to parse the text and output an object.