Userscript for downloading creations, and Sporecasts from the Sporepedia

Mods that combine many smaller mods or lonely mods that just have no place to go...
User avatar
Barely Harry
Posts: 2
Joined: Sat Feb 03, 2018 3:57 pm

Userscript for downloading creations, and Sporecasts from the Sporepedia

Unread post by Barely Harry »

I know this isn't really a mod as such, but I imagine there are quite a few people who only pay attention to the Spore modding section of this forum, and I'd like for this to be seen.

I've never been able to get Spore to actually download creations from the Sporecasts that I've subscribed to.
And, Spore never seems to download creations at a rate greater than one-per-second, which means if I need to download all my buddy's creations from scratch, I'll have to wait a few hours for them all to download, which is very annoying.

I decided to create a userscript for the Sporepedia to remedy this.

A userscript-manager browser-extension is required.
Violentmonkey is recommended (and tested), but Tampermonkey should also work (but was not tested). Greasemonkey will also work (but was not tested), save for one feature which will be missing.

The source-code of the userscript can be found here: ... 6a89ad05d1
And a direct installation link here: ... ns.user.js

Navigate to a page in the Browse tab of the Sporepedia, or open a Sporecast, and in the left-sidebar a control-panel like such should appear:

Explanation of Controls
1. Apply to: A drop-down menu with the following options:
  • Current Page: Operations will be performed on the current-page only.
  • All Pages: Operations will be performed on every page.
  • Current and All Following Pages: Operations will be performed on the current-page, and every page that comes after the current-page.
  • Current and All Previous Pages: Operations will be performed on the current-page, and every page that comes before the current-page.
2. Initial Page Load Sleep Duration (Milliseconds): A numeric input which specifies how long the userscript should wait (in milliseconds) after the page-number has changed.
  • This delay is necessary because the Sporepedia doesn't change the contents of the page immediately (or quickly), and as such, it appears as though the page has loaded, when in fact it hasn't even changed.
    This isn't an occurrence of lazy-programming, the userscript does actually check if all the creations have loaded before moving onto the next page, it just needs to wait for the Sporepedia to catch up.
    I don't recommended setting this value to anything below 1000, otherwise the userscript may: miss some creations, or retrieve duplicate creations.
    If you have a slow computer, or a slow connection, (or a slow browser, or the Sporepedia has become slow), this value may need to be increased for correct functionality.
3. Get User Creation Image URLs: This is a button which when pressed, will output the direct URLs of the PNG image files of the creations to the text-area of the control panel, according to the previously selected settings.

4. Download User Creation Image Files: This is a button which when pressed, will download the PNG image files of the creations, according to the previously selected settings.
Note that this feature only works with Violentmonkey, Tampermonkey, or any other userscript-manager which supports the GM_download API, this does not include Greasemonkey.

Important Notes
Web-browsers really are not meant for downloading hundreds (if not thousands) of image files all at once.
I don't recommended using the Download User Creation Image Files button for anything more than one page at a time.

Instead, I recommended using the Get User Creation Image URLs button, and supplying those images to some form of batch downloading software, such as cURL, wget, or PowerShell, and probably something like Jdownloader.
PowerShell is included in Windows 7 and up, so I've provided a small, simple code-snippet which will download a batch of URLs in the Examples section of this thread, below.

Getting the URLs for every creation made by a user
1. Go the the user's browse page, such as: ... 2262785743
2. Set Apply to to All Pages.
3. Click Get User Creation Image URLs.
4. Wait...

Getting the URLs for every creation after and including page-two, in a Sporecast
1. Open a Sporecast: ... 0017784787
2. Set Apply to to Current and All Following Pages.
3. Navigate to page 2.
4. Click Get User Creation Image URLs.
5. Wait...

Downloading many URLs in a batch using PowerShell

1. Save the URLs in a text file, with each URL on its own line (the userscript outputs in this format by default, you should be able to simply copy-and-paste the URLs from the text-area.)
2. Take note of the file-system address of the text-file you created, such as: C:/Users/Public/Documents/MyURLs.txt
3. Open a PowerShell prompt.
4. Navigate to the directory you want to save the image files to, in PowerShell, like so:

Code: Select all

Set-Location -LiteralPath 'C:/Users/Public/Downloads';
5. Assign the URLs to a variable called `MyURLs`, from the text file, like so:

Code: Select all

$MyURLs = Get-Content -LiteralPath 'C:/Users/Public/Documents/MyURLs.txt'
6. Copy-and-paste the following code snippet into PowerShell, it will download all the URLs contained in the variable called `MyURLs`:

Code: Select all

	$WebClient = New-Object -TypeName 'System.Net.WebClient';
	foreach ($Url in $MyURLs)
		 $FileName = Split-Path -Leaf -Path $Url;
		 $DownloadFilePath = Join-Path -Path ($PWD.Path) -ChildPath $FileName;
		 $WebClient.DownloadFile($Url, $DownloadFilePath);

Loading the Image Files into Spore
After downloading the images, you'll need to actually load the images into Spore.

To do this, follow the following instructions:
1. Open Spore.
2. Alt-tab out of Spore. (Windowed-mode will make this much easier, as you can keep Spore open in the background, and it will still process the images.)
3. Select (highlight) the image-files you want to load in Windows Explorer (known as File Explorer in Windows 10).
4. Drag the selected images onto the Spore window (you can still alt-tab), the mouse cursor will probably change to indicate that something will be dropped, or copied.
5. Release the left mouse-button, and Spore should begin to load all the creations present in the image files. This may take a while if many image files were dropped.

Everything Else
Using this userscript I was able to download, and load (which took a while) roughly nine-thousand creations in forty-minutes, which I think is pretty good considering the alternative would be waiting at least 2.5 hours, and not being able to use Sporecasts.

This userscript is licensed under the terms of the Creative Commons Zero, Version 1.0. Feel free to do whatever you want with it, under said terms.

Post Reply Previous topicNext topic

Return to “Miscellaneous Mods”