comicsrss.com icon indicating copy to clipboard operation
comicsrss.com copied to clipboard

Add support for multiple imageUrls for a single day's strip

Open tylerbenson opened this issue 2 years ago • 1 comments

I was trying to add support for it myself but it doesn't follow the existing models very nicely. I'll share some of what I've found:

To get a listing of all comics: GET https://storage.googleapis.com/tinyview-d78fb.appspot.com/tinyview/comic-series-directory/directory.json

To get the list of urls for a specific comic: POST https://us-central1-tinyview-d78fb.cloudfunctions.net/getComics

content-type: application/json

{"data":{"series":"itchy-feet","startAfter":null,"records":10}}

The comics come in individual panels. To get their image URLs: GET https://storage.googleapis.com/tinyview-d78fb.appspot.com/itchy-feet/2023/10/22/unconditional-love/index.json

eg: https://storage.googleapis.com/tinyview-d78fb.appspot.com/itchy-feet/2023/10/22/unconditional-love/1.jpg

If you can only do a single image, it'll still be nice to show the preview image and encourage folks to visit the site directly. I am just annoyed they don't have RSS.

Let me know if you need additional guidance or questions. Really appreciate this service.

tylerbenson avatar Oct 27 '23 03:10 tylerbenson

Ok, so I assumed one image per day in my data model: https://github.com/ArtskydJ/comicsrss.com/blob/gh-pages/_generator/tmp/comicskingdom-series-objects.json

I'd accept a PR to switch imageUrl from a string into an array of strings (and rename it imageUrls).

To transform the existing JSON, I recommend writing a migration and running node _generator/bin --migrate. https://github.com/ArtskydJ/comicsrss.com/blob/b0b86a8b8c8f0ff11aa9378c1e5d0cd8f77b5627/_generator/bin.js#L13-L16

The migration would looks something like:

function migration([ id, seriesObject ]) {
	seriesObject.strips.forEach(strip => {
		const imageUrl = strip.imageUrl
		delete strip.imageUrl
		strip.imageUrls = [ imageUrl ]
	})
	return [ id, seriesObject ]
}

The bigger project is changing every place that references series.strips[x].imageUrl, and making sure it's using an array instead. (Some of the linked search results refer to series.imageUrl which should stay a string.)

If you're familiar with JavaScript, I don't think this would be very hard... But that's pretty easy for me to say since I'm familiar with my own project.

I don't feel like I have time to make this change myself. Please reply with any more questions.


Adding TinyView would be its own project, quite separate to the imageUrl: string -> imageUrls: string[] transformation. You'd probably want to make a new "multipage" scraper. I'd probably copy/paste from https://github.com/ArtskydJ/comicsrss.com/blob/gh-pages/_generator/scrapers/comicskingdom.js to start.

ArtskydJ avatar Oct 27 '23 04:10 ArtskydJ