Open Stormghetti opened 4 years ago
I think the best solution for playing back gif, webm or oder video files is to run a video player for the downloaded file in the cache (or local, if it already exists). That would skip any kind of authentication or HTTP Header shenanigans required for e.g. pixiv and would use native tools like mpv.
The issue with "videos" on Pixiv is that they aren't really videos, but more like some frame-by-frame images in a worse format than GIF (ugoira / ZIP).
And their API only gives the link to a smaller ZIP version, usually 600x600, with a result such as:
{
"status": "success",
"response": [
{
// ...
"type": "ugoira",
"image_urls": {
"large": "https://i.pximg.net/img-original/img/..._ugoira0.jpg"
},
"metadata": {
"zip_urls": {
"ugoira600x600": "https://i.pximg.net/img-zip-ugoira/img/..._ugoira600x600.zip"
},
"frames": [
{
"delay_msec": 500
},
// ...
{
"delay_msec": 500
}
]
}
}
],
"count": 1
}
Currently, Grabber just takes the image_urls.large
field, which contains the first frame of the ugoira. It is also unable to download other images. Adding the "player" icon could be possible, but a real solution would be to add proper support for ugoira in Grabber.
From what I can see, for this Grabber should, for each "frame" in metadata.frames
, add an URL to by taking image_urls.large
and replacing _ugoira0
by _ugoira
and the index of the frame. It would generate N URLs that Grabber should download individually then pack as a GIF/ZIP file.
I'm not sure if this has been mentioned already, but I wouldn't doubt it. I know Pixiv seems to have an issue with letting people copy videos/gifs to share them around as-is, so adding support for that in Grabber sounds tricky; I don't know the specifics of it. However, I'm wondering if adding a play icon on the thumbnail of the upload could be possible. The same thing you see with the boorus. At the very least, I'd know I should open it on my browser in order to see everything.