asciinema / asciicast2gif

Generate GIF animations from asciicasts (asciinema recordings)
MIT License
1.2k stars 83 forks source link

Support server URLs without appended file extension #44

Closed tomas closed 2 years ago

tomas commented 6 years ago

Hi, I'm trying to run asciicast2gif against a recording I just posted online, but I'm getting the following output:

==> Loading https://asciinema.org/a/AsPWpL1qCvInbNAAVBfbDfRhy...
only asciicast v1 and v2 formats can be opened
==> Done.

Running locally it doesn't work, as well:

==> Loading /tmp/tmpi1soul1l-ascii.cast...
==> Spawning PhantomJS renderer...
==> Generating frame screenshots...
==> Couldn't get geometry of requested DOM element
/usr/local/lib/node/lib/node_modules/asciicast2gif/main.js:696
[ ... ]

Any pointers? Thanks!

funilrys commented 6 years ago

:+1: I get the same here ...

tomas commented 6 years ago

Ping @sickill :)

dhimmel commented 5 years ago

I got the same error message when passing an asciinema.org URL. However, after looking into it, there doesn't appear to be a version 3 of the asciicast format and when I run asciinema --version locally, it showed I have version 2.0.0 which should be using the asciicast v2 format.

Hence, I realized we're just passing URLs that don't resolve to asciicast files. If you append .cast to the asciinema.org URL, then asciicast2gif should work. Try:

asciicast2gif https://asciinema.org/a/AsPWpL1qCvInbNAAVBfbDfRhy.cast output.gif

Perhaps a better error message in this case or support for asciinema.org URLs would be good enhancements.

berkant commented 5 years ago

@dhimmel It didn't work for me.

dhimmel commented 5 years ago

It didn't work for me.

It would be helpful to see the command you ran and the output that was provided.

ku1ik commented 5 years ago

@dhimmel is correct, right now you need to add .cast (or .json) ext to the URL, since asciicast2gif can't resolve it.

asciicast

It would definitely be nice if it happened automatically. I plan to work on better content-type negotiation support on server side, this should solve this case then.

Xtigyro commented 4 years ago

It doesn't seem to work:

~/repos/xtigyro/deploy-kubernetes-kind # asciicast2gif https://asciinema.org/a/348726.cast demo.gif
==> Loading https://asciinema.org/a/348726.cast...
==> Spawning PhantomJS renderer...
/usr/local/lib/node_modules/asciicast2gif/main.js:697
Qe)}function ep(a){try{var b=a[0];return b.h?b.h(a):b.call(null,a)}catch(c){if(c instanceof Object)throw b=c,Yo(a[6]),b;throw c;}}function fp(a,b,c){c=Zo(c,dp(function(c){a[2]=c;a[1]=b;return ep(a)}));return r(c)?(a[2]=Nb(c),a[1]=b,dj):null}function gp(a,b){a=a[6];null!=b&&a.Dc(null,b,dp(function(){return function(){return null}}(a)));Yo(a);return a}
                                                                                                   ^

TypeError [ERR_INVALID_ARG_TYPE]: The "file" argument must be of type string. Received type object
    at validateString (internal/validators.js:125:11)
    at normalizeSpawnArguments (child_process.js:411:3)
    at spawn (child_process.js:545:16)
    at Function.exports.exec (/usr/local/lib/node_modules/asciicast2gif/node_modules/phantomjs-prebuilt/lib/phantomjs.js:72:10)
    at Ke (/usr/local/lib/node_modules/asciicast2gif/main.js:262:219)
    at Je (/usr/local/lib/node_modules/asciicast2gif/main.js:261:410)
    at Ie (/usr/local/lib/node_modules/asciicast2gif/main.js:261:320)
    at He (/usr/local/lib/node_modules/asciicast2gif/main.js:261:238)
    at Le (/usr/local/lib/node_modules/asciicast2gif/main.js:266:230)
    at xp (/usr/local/lib/node_modules/asciicast2gif/main.js:705:224)
Xtigyro commented 4 years ago

This seems to be a different problem - even though I've followed the default install steps on Ubuntu 20.04 - the aforementioned error occurs.

However, using the Docker container did the job well:

~/repos/xtigyro/deploy-kubernetes-kind # docker run --rm -v $PWD:/data asciinema/asciicast2gif https://asciinema.org/a/348726.cast demo.gif
==> Loading https://asciinema.org/a/348726.cast...
==> Spawning PhantomJS renderer...
==> Generating frame screenshots...
==> Combining 871 screenshots into GIF file...
==> Done.
Zonalds commented 3 years ago

@Xtigyro

This seems to be a different problem - even though I've followed the default install steps on Ubuntu 20.04 - the aforementioned error occurs.

However, using the Docker container did the job well:

~/repos/xtigyro/deploy-kubernetes-kind # docker run --rm -v $PWD:/data asciinema/asciicast2gif https://asciinema.org/a/348726.cast demo.gif
==> Loading https://asciinema.org/a/348726.cast...
==> Spawning PhantomJS renderer...
==> Generating frame screenshots...
==> Combining 871 screenshots into GIF file...
==> Done.

Were you able to find a solution?

Xtigyro commented 3 years ago

@Zonalds Yeah - just use the Docker image.

ku1ik commented 2 years ago

Try asciicast2gif's successor - https://github.com/asciinema/agg - it handles content type negotiation fine without the extension in URL.