I will do a worked example with you. Looking at, for example mastermixdj, I can do a test search on it and see that the search URL is https://mastermixdj.com/?s=
Running with the network inspector devtool open I can see that it's dynamically creating the results HTML by calling an API, it calls:
https://mastermixdj.com/wp-json/api/v1/get/search/results?type=albums&search=TheSearchTerm&limit=4 and also the same API with type singles and limit 10. When writing your script you can customise this to whatever you want, but for now let's just do albums and keep the same limit they have.
The JSON returned is nice and easy to deal with, we don't even have to do HTML scraping, so great.
For JSON, the idea is to create a class that matches the bits structure of the JSON returned that we are interested in, and then do:
json = JavaScriptSerializer()
searchResults = json.Deserialize[of (SearchResults)](jsonSearchResults)
on it to parse it. SearchResult is wrapped in () because in the case of MasterMixDj it's an array of results retuned. If it was a single object, it wouldn't have those parenthesis. The JSON structure returned by MasterMixDj is an array of objects, where the interesting bits of the object (for us) are labelled title, artwork and link, so this would mean a class like:
class SearchResult:
public title as String
public artwork as String
public link as String
Now we've parsed the results, they must be reported to AlbumArtDownloader. This is done using the results.Add method, which takes the parameters object thumbnail, string name, string infoUri, int fullSizeImageWidth, int fullSizeImageHeight, object fullSizeImageCallback, CoverType coverType, string suggestedFilenameExtension. There are overloads with fewer parameters you can see at IScriptResults.cs. For our case, we know the artwork, title (name) and link (infoUri). For artwork, this source doesn't provide separate small thumbnail images, it just shows the full size images resized. So we won't bother with thumbnails and just provide the artwork as the thumbnail.
As we don't have a separate full size image, we can just ignore fullSizeImageCallback and pass null to that. It's what gets given back to us in the RetrieveFullSizeImage method, which again, as we don't have separate full size images, we don't care about.
For size, we don't know it. the source doesn't provide that info, so just use -1, -1 for "unknown". For cover type, it looks like they are all just front covers, so we can pass CoverType.Front for that and end up with:
for searchResult in searchResults:
results.Add(searchResult.artwork, searchResult.title, searchResult.link, -1, -1, null, CoverType.Front)
Final result is attached.
There's more that could be done with this source. For example, looking at the album page I can see that there is a facility for getting thumbnails, by appending "-100x100" to the artwork between "primary" and "jpg" so we could use that for faster results without downloading the full size one for every result. I can also see that there are additional images that could be found by replacing primary with "additional-1" (and presumably numbers past 1 if they existed). I'll leave all of that as an exercise for the reader, though.
This should give you enough of an idea as to how to do it that you can work on other scripts. If you produce any, please post them here for others to enjoy too!
Alex