Hi TechThoughts. Extremely grateful for your tutorials. How would i adjust the title length in '$posts | Select-Object Title,Score | Sort-Object Score -Descending'? Some of the reddit post lengths are way too lengthy. Thank you.
You can use Format-List instead: $posts | Select-Object Title,Score | Sort-Object Score -Descending | Format-List If you have to use Format-Table, it is unfortunately pretty tricky to define custom column widths for a table: stackoverflow.com/questions/38554966/controlling-column-widths-with-format-table
Absolutely. TH-cam does have some great teachers who explain way better than some $1000 paid courses. The challenge is to find them out. It's even tougher now that TH-cam has removed the dislike counts.
while i was trying with this line $objData = $rawJSON | ConvertFrom-Json ... it is throwing below error ''Conversion from JSON failed with error: Unexpected character encountered while parsing value:
@@Techthoughts2 #retrieve dynamic content from a website $webResults = Invoke-WebRequest -Uri 'reddit.com/r/powershell.json' $rawJSON = $webResults.Content $objData = $rawJSON | ConvertFrom-Json $posts = $objData.data.children.data $posts | Select-Object Title,Score | Sort-Object Score -Descending I tried both Desktop and core edition but it returns only one object
I have verified that this code does indeed work as intended. Can you please indicate the error you are receiving? Can you clarify what you mean by only one object? You should only be receiving one object, the json payload. But, it can be drilled into to discover many sub properties containing content.
This series is proof that treasure does exist on this planet 👏🏻
Learned a lot, truly great tutorial.
Hi TechThoughts. Extremely grateful for your tutorials. How would i adjust the title length in '$posts | Select-Object Title,Score | Sort-Object Score -Descending'? Some of the reddit post lengths are way too lengthy. Thank you.
You can use Format-List instead:
$posts | Select-Object Title,Score | Sort-Object Score -Descending | Format-List
If you have to use Format-Table, it is unfortunately pretty tricky to define custom column widths for a table:
stackoverflow.com/questions/38554966/controlling-column-widths-with-format-table
Honestly.. I watched Pluralsight course videos..and this playlist is 100x better than Pluralsight!
That means a lot!
Absolutely. TH-cam does have some great teachers who explain way better than some $1000 paid courses.
The challenge is to find them out.
It's even tougher now that TH-cam has removed the dislike counts.
while i was trying with this line $objData = $rawJSON | ConvertFrom-Json ... it is throwing below error ''Conversion from JSON failed with error: Unexpected character encountered while parsing value:
How I wish the working files were at the github link to follow along.
Many thanks for giving code
Nice tutorial, thanks :)
where can I get the Sample.log file
the font is too small
Thanks for the feedback. It looks like I didn't increase it on this lesson. I'll make sure that subsequent videos have a larger font.
@@Techthoughts2 Looks good on my 1440p monitor :)
I can retrieve only one object, I just copy-paste code from your site sill it is retrieving only one object
Please paste the code you are having issues with.
@@Techthoughts2
#retrieve dynamic content from a website
$webResults = Invoke-WebRequest -Uri 'reddit.com/r/powershell.json'
$rawJSON = $webResults.Content
$objData = $rawJSON | ConvertFrom-Json
$posts = $objData.data.children.data
$posts | Select-Object Title,Score | Sort-Object Score -Descending
I tried both Desktop and core edition but it returns only one object
I have verified that this code does indeed work as intended. Can you please indicate the error you are receiving? Can you clarify what you mean by only one object? You should only be receiving one object, the json payload. But, it can be drilled into to discover many sub properties containing content.
Font size is too small, can't see.....