From 2bee0d6f2ca46554c32d37564d5a48fb37caf6f6 Mon Sep 17 00:00:00 2001 From: Gabi <218829269+GabiNun2@users.noreply.github.com> Date: Wed, 3 Jun 2026 21:36:42 +0300 Subject: [PATCH] Update Invoke-WinUtilSponsors.ps1 (#4589) --- functions/private/Invoke-WinUtilSponsors.ps1 | 44 +------------------- 1 file changed, 2 insertions(+), 42 deletions(-) diff --git a/functions/private/Invoke-WinUtilSponsors.ps1 b/functions/private/Invoke-WinUtilSponsors.ps1 index 54484500..5ec3fe8f 100644 --- a/functions/private/Invoke-WinUtilSponsors.ps1 +++ b/functions/private/Invoke-WinUtilSponsors.ps1 @@ -1,44 +1,4 @@ Function Invoke-WinUtilSponsors { - <# - .SYNOPSIS - Lists Sponsors from ChrisTitusTech - .DESCRIPTION - Lists Sponsors from ChrisTitusTech - .EXAMPLE - Invoke-WinUtilSponsors - .NOTES - This function is used to list sponsors from ChrisTitusTech - #> - try { - # Define the URL and headers - $url = "https://github.com/sponsors/ChrisTitusTech" - $headers = @{ - "User-Agent" = "Chrome/58.0.3029.110" - } - - # Fetch the webpage content - try { - $html = Invoke-RestMethod -Uri $url -Headers $headers - } catch { - Write-Output $_.Exception.Message - exit - } - - # Use regex to extract the content between "Current sponsors" and "Past sponsors" - $currentSponsorsPattern = '(?s)(?<=Current sponsors).*?(?=Past sponsors)' - $currentSponsorsHtml = [regex]::Match($html, $currentSponsorsPattern).Value - - # Use regex to extract the sponsor usernames from the alt attributes in the "Current Sponsors" section - $sponsorPattern = '(?<=alt="@)[^"]+' - $sponsors = [regex]::Matches($currentSponsorsHtml, $sponsorPattern) | ForEach-Object { $_.Value } - - # Exclude "ChrisTitusTech" from the sponsors - $sponsors = $sponsors | Where-Object { $_ -ne "ChrisTitusTech" } - - # Return the sponsors - return $sponsors - } catch { - Write-Error "An error occurred while fetching or processing the sponsors: $_" - return $null - } + $sponsors = ([regex]::Matches(([regex]::Match((irm https://github.com/sponsors/ChrisTitusTech),'(?s)(?<=Current sponsors).*?(?=Past sponsors)')).Value,'(?<=alt="@)[^"]+')).Value | Where-Object {$_ -ne "ChrisTitusTech"} + return $sponsors }