artoo icon indicating copy to clipboard operation
artoo copied to clipboard

artoo.saveImage seems to always error out with: "Uncaught TypeError: i.getExtension is not a function"

Open kyle-wendling opened this issue 8 years ago • 7 comments

I've tried to trace back through minified spaghetti, looks like 'i' is Emmett instance, and it doesn't have this function?

artoo.saveImage('img',{filename:'test.jpg'});

Uncaught TypeError: i.getExtension is not a function at o.artoo.saveImage (artoo-latest.min.js:2) at :1:7

kyle-wendling avatar Feb 07 '17 15:02 kyle-wendling

That's a strange issue. Did you load the bookmarklet from the documentation's site? Emmet should be bundled with it.

Yomguithereal avatar Feb 07 '17 15:02 Yomguithereal

Thanks for quick response, using latest bookmarklet (yesterday) Pretty frustrating, savePageHtml works fine but no dice on saveImage, I could just be doing something wrong, but are you sure project isn't just in a broken state?

tracing it back from github source: src/methods/artoo.methods.save.js var ext = helpers.getExtension($sel.attr('src')),

var _root = this, helpers = artoo.helpers;

but artoo.helpers as defined in artoo/src/artoo.helpers.js has no getExtension method?

repro: running on page: http://imgur.com/gallery/j2sqN

artoo.scrape('img[src*=OccRL0yr]','src');
["//i.imgur.com/OccRL0yr.jpg"]
artoo.saveImage('img[src*=OccRL0yr]',{filename:'test.jpg'});
artoo-latest.min.js:2 Uncaught TypeError: i.getExtension is not a function
    at o.artoo.saveImage (artoo-latest.min.js:2)
    at <anonymous>:1:7
artoo.saveImage @ artoo-latest.min.js:2
(anonymous) @ VM1358:1
artoo.saveImage('img',{filename:'test.jpg'});
artoo-latest.min.js:2 Uncaught TypeError: i.getExtension is not a function
    at o.artoo.saveImage (artoo-latest.min.js:2)
    at <anonymous>:1:7

kyle-wendling avatar Feb 08 '17 00:02 kyle-wendling

Well that's quite strange, I don't know why but this helper has indeed disappeared. I need to add it back. Can you ping me if I forget please?

Yomguithereal avatar Feb 08 '17 09:02 Yomguithereal

thanks, please LMK!

kyle-wendling avatar Feb 10 '17 03:02 kyle-wendling

Just released a v0.3.4 that should solve your issue. Be sure to empty your browser's cache and that the bookmarklet loads the correct version when loading artoo.

Yomguithereal avatar Feb 10 '17 08:02 Yomguithereal

thanks! I've implemented a more robust spider that can handle XHR request http errors, would you be interested in incorporating, should I sub a pull req?

jawas_42e63e07

kyle-wendling avatar Mar 23 '17 15:03 kyle-wendling

Can you show me your code or its documentation somehow?

Yomguithereal avatar Mar 23 '17 15:03 Yomguithereal