Last active 1735985299

anduin's Avatar anduin revised this gist 1735985299. Go to revision

1 file changed, 2 insertions, 1 deletion

Unlist.ps1

@@ -47,7 +47,7 @@ $packages = @(
47 47 )
48 48
49 49
50 - $apiKey = "assssssssssssssssssss"
50 + $apiKey = "aaaaaaaaaaaaaaaaaaaaaaaaa"
51 51
52 52 function Remove-AllNuGetPackageVersions($PackageIds, $ApiKey)
53 53 {
@@ -60,6 +60,7 @@ function Remove-AllNuGetPackageVersions($PackageIds, $ApiKey)
60 60 foreach ($version in $json.versions) {
61 61 Write-Host "Unlisting $PackageId, Version $version"
62 62 Invoke-Expression "dotnet nuget delete $PackageId $version --non-interactive --api-key $ApiKey --source https://api.nuget.org/v3/index.json"
63 + Start-Sleep -Seconds 10
63 64 }
64 65 }
65 66 catch {

anduin's Avatar anduin revised this gist 1735984730. Go to revision

1 file changed, 66 insertions, 8 deletions

Unlist.ps1

@@ -1,14 +1,72 @@
1 - function Remove-AllNuGetPackageVersions($PackageId, $ApiKey)
1 + # 示例:对多个包执行Unlist操作
2 + $packages = @(
3 + "Aiursoft.Archon.SDK",
4 + "Aiursoft.Developer.SDK",
5 + "Aiursoft.Directory.SDK",
6 + "Aiursoft.DocGenerator.Abstract",
7 + "Aiursoft.DotDownload.Core",
8 + "Aiursoft.Dotlang.Core",
9 + "Aiursoft.Gateway.SDK",
10 + "Aiursoft.Handler",
11 + "Aiursoft.Handler.Abstract",
12 + "Aiursoft.Pylon",
13 + "Aiursoft.SDK",
14 + "Aiursoft.SDK.Tests",
15 + "Aiursoft.SDKTools",
16 + "Aiursoft.SnakeGame",
17 + "Aiursoft.Stargate.SDK",
18 + "Aiursoft.Status.SDK",
19 + "Aiursoft.UiStack",
20 + "Aiursoft.Wrapgate.SDK",
21 + "Aiursoft.XelNaga",
22 + "AiurVersionControl",
23 + "AiurVersionControl.CRUD",
24 + "Anduin.HappyRecorder.Calendar",
25 + "Anduin.HappyRecorder.PluginFramework",
26 + "Anduin.QRCoder",
27 + "Anduin.QRCoder.NET",
28 + "Crawler.CLTeans",
29 + "Crawler.FantasticBodies",
30 + "Crawler.FlexyTeens",
31 + "Crawler.Shared",
32 + "DemoApiApp.Sdk",
33 + "Diff4Net.Core",
34 + "Kahla.SDK",
35 + "MoongladePure.Comments",
36 + "MoongladePure.Configuration",
37 + "MoongladePure.Core",
38 + "MoongladePure.Data",
39 + "MoongladePure.Data.MySql",
40 + "MoongladePure.FriendLink",
41 + "MoongladePure.ImageStorage",
42 + "MoongladePure.Syndication",
43 + "MoongladePure.Theme",
44 + "MoongladePure.Utils",
45 + "MoongladePure.Web",
46 + "NiBot"
47 + )
48 +
49 +
50 + $apiKey = "assssssssssssssssssss"
51 +
52 + function Remove-AllNuGetPackageVersions($PackageIds, $ApiKey)
2 53 {
3 - $lower = $PackageId.ToLowerInvariant();
54 + foreach ($PackageId in $PackageIds) {
55 + $lower = $PackageId.ToLowerInvariant()
4 56
5 - $json = Invoke-WebRequest -Uri "https://api.nuget.org/v3-flatcontainer/$lower/index.json" | ConvertFrom-Json
57 + try {
58 + $json = Invoke-WebRequest -Uri "https://api.nuget.org/v3-flatcontainer/$lower/index.json" -ErrorAction Stop | ConvertFrom-Json
6 59
7 - foreach($version in $json.versions)
8 - {
9 - Write-Host "Unlisting $PackageId, Ver $version"
10 - Invoke-Expression "dotnet nuget delete $PackageId $version --non-interactive --api-key $ApiKey --source https://api.nuget.org/v3/index.json"
60 + foreach ($version in $json.versions) {
61 + Write-Host "Unlisting $PackageId, Version $version"
62 + Invoke-Expression "dotnet nuget delete $PackageId $version --non-interactive --api-key $ApiKey --source https://api.nuget.org/v3/index.json"
63 + }
64 + }
65 + catch {
66 + Write-Host "Error unlisting $PackageId $_" -ForegroundColor Red
67 + }
11 68 }
12 69 }
13 70
14 - Remove-AllNuGetPackageVersions -PackageId "MoongladePure.Web" -ApiKey "YOUR_KEY"
71 + Remove-AllNuGetPackageVersions -PackageIds $packages -ApiKey $apiKey
72 +

anduin's Avatar anduin revised this gist 1735984287. Go to revision

1 file changed, 14 insertions

Unlist.ps1(file created)

@@ -0,0 +1,14 @@
1 + function Remove-AllNuGetPackageVersions($PackageId, $ApiKey)
2 + {
3 + $lower = $PackageId.ToLowerInvariant();
4 +
5 + $json = Invoke-WebRequest -Uri "https://api.nuget.org/v3-flatcontainer/$lower/index.json" | ConvertFrom-Json
6 +
7 + foreach($version in $json.versions)
8 + {
9 + Write-Host "Unlisting $PackageId, Ver $version"
10 + Invoke-Expression "dotnet nuget delete $PackageId $version --non-interactive --api-key $ApiKey --source https://api.nuget.org/v3/index.json"
11 + }
12 + }
13 +
14 + Remove-AllNuGetPackageVersions -PackageId "MoongladePure.Web" -ApiKey "YOUR_KEY"
Newer Older