Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
tylerbenson opened this issue Oct 27, 2023 · 1 comment
Open

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

tylerbenson opened this issue Oct 27, 2023 · 1 comment

Comments

@tylerbenson
Copy link

tylerbenson commented Oct 27, 2023

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.

@ArtskydJ
Copy link
Owner

ArtskydJ commented Oct 27, 2023

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.

function migration([ id, seriesObject ]) {
// seriesObject.strips = seriesObject.strips.filter(s => s.date !== null && s.date.slice(7) !== '2020-09') // bye bye all this month
return [ id, seriesObject ]
}

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 ArtskydJ changed the title Add support for TinyView Add support for multiple imageUrls for a single day's strip Oct 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants