kevinsqi / save_tabbed_images

A chrome extension which lets you easily download all images opened in tabs
40 stars 15 forks source link

Help expanding potential applications for this extension #42

Closed Moscarda closed 6 years ago

Moscarda commented 6 years ago

Great work! I'm particularly fond of any extension that can automate menial tasks in general, but sorting and closing tabs after they are no longer needed has helped me enormously. I'm not even a developer. but by inspecting your code, I've managed to tweak a few forks of this repo to expand the number and types of files to save. I will upload and credit you when finished.

I would like to apply the same conditional logic that sorts tabs by their filetype to a new extension that sorts all tabs containing another variable, such as the domain. My goal is to grab all tabbed Wikipedia articles by the pattern .wikipedia.org/wiki/ and then programatically export them using Wikipedia's own Save As PDF feature.

Automating the first part of this process is simple enough: simply insert the article name (underscored if more than one word) into a url structured like so:

https://en.wikipedia.org/w/index.php?title=Special:ElectronPdf&page=Github&action=show-download-screen

In this example I am using the Github article at https://en.wikipedia.org/wiki/Github

However that's only part of a solution, I still need a way to programatically click the button to save the Github.pdf article, and plug that functionality into an extension that behaves like Save_Tabbed_Images and can export pdfs for all tabbed Wiki articles as simply as saving tabbed images...that is, with the click of a button.

I may not be a developer, but I am happy to put in the work myself: I would just appreciate some help getting started and your extension seemed like the best starting point out of the open source repos I've found.

Thanks in advance.

kevinsqi commented 6 years ago

Hi @Moscarda!

This sounds quite doable actually, and quite similar to SaveTabbedImages. If you look at what happens when you click on the download PDF link when you visit, say, https://en.wikipedia.org/wiki/House_sparrow, you'll see this:

screen shot 2018-01-30 at 9 47 59 pm

If this pattern holds up in general, you should be able to get the article name of the page from the URL, e.g. House_sparrow, and then make a download request to the URL /api/rest_v1/page/pdf/<article_name>.

Hope this helps!