Jump to content

Get Image Links


TheSaint
 Share

Recommended Posts

This program is a bit of a joint venture between myself and TheDcoder.

I created the program, then as I usually do, mentioned it to TheDcoder in passing ... we chat most days on HexChat (freenode). He then kindly suggested he could create a script (browser plugin/addon) to make it even simpler. I said go for it, and he did. We have only tested it on Chrome (him) and Brave (me) ... Brave is the fastest browser I know and a Chrome clone, and the script works well. I then modified my program to suit his addon. A BIG THANKS to him. :)

NOTE - We used the ViolentMonkey addon to install and run his script with, but he assures me it should also work fine with GreaseMonkey and other browsers. If you want to use his script, then something like one of those is required.

https://violentmonkey.github.io/

IMPORTANT - The script will attempt to work on every site, so best to disable when not required or you will get pestered with popups. This is simply done by deselecting the script from the ViolentMonkey addon browser toolbar button option. I imagine GreaseMonkey etc will have similar.

Installing the script via the program's INSTALL button, requires you to have your default browser already running, and ViolentMonkey or GreaseMonkey etc, already installed. If not, then you will be prompted to download the script instead.

The program 'Get Image Links' basically allows you to get some images, that you cannot easily get by right-click and save, in your browser. TheDcoder tells me this is because in the instances I wanted to use it for, the images were set as background images for the game page links. So even saving the web page does not get them, though the links are in the source code of the saved page.

It particularly works well with the large thumbnail game images at both Itch.io and IndieGala ... not yet tried with any other site. Basically I download free games from them, and then grab each cover image thumbnail to set as the folder image for each game.

There is two methods (ways) to use the program.
(1) Use TheDcoder's script.
(2) Save the web page.
Both methods usually require you to scroll to the last image, so that every image has shown in your browser, and then becomes available.

STEP 1

(1) Using TheDcoder's script.

Install script (once) and enable at need for the site you are wanting to grab images from.
Visit the site and page you want or refresh, so that you see a popup from the script ... which tells you to use CTRL+SHIFT+C to grab the links when ready.
On the use of CTRL+SHIFT+C another popup should tell you how many links have been copied.
Then click the IMPORT button on the 'Get Image Links' program, and links will be copied from the clipboard, to the List field.

(2) Saving the web page.

This is my original method and not as quick and simple as TheDcoder's script.
Visit the site and page you want, then save that page locally on your PC.
Drag & Drop that saved page, onto the List area of the 'Get Image Links' program.
Hopefully, all the links will be extracted and populate the List field.
Remove any undesirables.
NOTE - My program provides some defaults for line splitting and link section extraction. They work for Itch.io and IndieGala ... though the latter may need a removal or three.

Please note, that the two methods above, replace existing entries on the List.
To add instead, you need to hold down CTRL when either clicking the IMPORT button or using Drag & Drop.

STEP 2

You can elect to download each image link individually or all, with one click of the DOWNLOAD button.
The DOWNLOAD button also alternatively works as a REMOVAL button, if the 'Wipe' option is selected.

Before clicking DOWNLOAD, set the destination path, using that option ... or go with the default of My Documents ... a sub-folder called 'Images' is created in any case.

Once an image file has been downloaded successfully, then it gets 4 asterisk in front of the URL in the List.

Selecting an entry on the List that has been downloaded, you can view that image file, by clicking the VIEW button, which uses your default viewer program.

If you re-import Links from the same site and have not relocated the downloads, then any existing entry gets those 4 asterisk and is skipped during further downloading.

GetImages_1.png.c6f304411803bd2ae2d2246a5ac8e9d6.png

NOTE ALSO, that the program remembers its screen position when closed. It also checks every 5 seconds, for an active Internet connection and enables or disables two buttons accordingly ... if needed. As you can see from the screenshot, I tested it offline.

TheDcoder's GitHub page for the browser addon script. Please go there and give him a Star. :)

Get Image Links v1.2.zip  (source is included)

Get Image Links v1.1.zip  (5 + 9 + 15 previous downloads)

Working on the update due to wrong script link, back with it shortly. The script works but was an earlier version without the count. My apologies.

 

Enjoy!

Edited by TheSaint

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

I have now fixed the program and it is available again. See first post.

My apologies to those five who downloaded it, TheDcoder and I got our wires crossed ... and unfortunately he wasn't around to check, when I first uploaded.

The program for those five and me, will replace the old script link in the 'Settings.ini' file if found, with the new.

TheDcoder tells me it is a limitation of Gist at Git that updates are a new link, so that means any update will mean breaking what is built into the program. My way around that, was the writing to the INI file, which I had added by default. So any future updates to the script will mean providing the updated link here, for manually pasting into the INI file, if users aren't savvy enough to work things out for themselves.

Of course, the best method of dealing with a script update, is to just go to the Git web page and manually update by clicking on the link.

https://gist.github.com/TheDcoder/bbd889d4626d06f5293dfe9a2f06d12d


Seeing as I had to change and compile my script again, I decided to tweak the browsing for destination values arrangement, so it now works better.

Edited by TheSaint

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

25 minutes ago, TheSaint said:

Of course, the best method of dealing with a script update, is to just go to the Git web page and manually update by clicking on the link.

https://gist.github.com/TheDcoder/bbd889d4626d06f5293dfe9a2f06d12d

Just to clarify, you need to click the "Raw" button to get the raw plain text script, and if you have ViolentMonkey installed, it will prompt you to update the script. This link will always point to the latest version as it is the link for the "project" itself. "Raw" links are tied to specific commits so they will always serve the same file even if the project was updated. This is a feature of Git, unfotunately we don't have a dynamic raw link which always points to the latest version, this is a limitation of GitHub Gist.

EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time)

DcodingTheWeb Forum - Follow for updates and Join for discussion

Link to comment
Share on other sites

Two of the sites the save web page and script methods work for are.

https://www.indiegala.com/showcase

https://itch.io/my-collections  and perhaps https://itch.io/my-purchases

Edited by TheSaint

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

TheDcoder has updated his script (v1.3) to fix two issues - unwanted popups and the temporary acquisition of CTRL+SHIFT+C

BIG THANKS DC. :)

Grab here, clicking on the RAW button to have it install and update.

https://gist.github.com/TheDcoder/bbd889d4626d06f5293dfe9a2f06d12d

Edited by TheSaint

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

Program has been updated to Get Image Links v1.1, see first post.

It involves a bugfix, due to a change of line endings from TheDcoder's script, which he tells me is the browser's fault for modifying what is sent to the clipboard.

Previously my program was dividing on @CRLF during Import. Today that did not work for me, and I found it instead needed @LF.

To cover all bases, my program now tests for more than one @CRLF first, and if not found then tests for more than one @LF, then if that not found, tests for @CR.

Hopefully that solves any future issues in that regard.

 

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

1 minute ago, TheSaint said:

which he tells me is the browser's fault

It certainly is, the line which creates the final big multi-line string has never changed since the first version:

 

urls = urls.join('\n');

 

EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time)

DcodingTheWeb Forum - Follow for updates and Join for discussion

Link to comment
Share on other sites

Get Image Links has been updated to v1.2. See first post.

(v1.2)
Added an ON TOP button, so you can toggle that state for the program window.
Also added a checkbox (replacing the Is Pressed function), to keep URL entries on the list when adding new ones via IMPORT button.
BUGFIX for a single URL without a trailing carriage return or line feed, which now also incorporates the ability, to add a single copied element, from your browser's Inspect option, and extract just the URL portion, using the IMPORT button to grab that from the clipboard.

NOTES
While waiting for TheDcoder to do some improvements to his browser script that assists this program, I decided to do some improvements of my own, and while doing that I also discovered a bug and fixed. I need his improvement, because with the huge number of games I've gotten recently from Itch.io with their special deal, I have a lot of game cover images to get, and his script doesn't work with the specific page of my collection at Itchy for those recent games.

I also meanwhile, not knowing how long TheDcoder might take, decided to improve things by adding another, albeit slower alternate method, to grab the image URLs. Basically, with a Chrome based browser at least, I right-click an image I cannot save in my browser, and select INSPECT from the resulting menu. That opens up the Inspection window on the right half of my browser window, and shows a highlighted page element. I then right-click that element, then choose COPY --> Copy Element. The element is copied to the clipboard, and I then use the IMPORT button of my program to extract the URL from the clipboard text. Repeat ad nauseum.

Edited by TheSaint

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

TheDcoder has now provided me with a new script, rather than an update to the old one. Thanks buddy, works a treat. :)

The new script only works for an Itch.io Collection page.

To use it, click the create New script option in something like VioletMonkey, and paste over with the following script. Then click Save & Close. You can also enable at right. And will need to refresh at least once if already at your Collection page. You can toggle the on or off state for the script.

// ==UserScript==
// @name        Itch.io Collection Game Cover Copier
// @namespace   Violentmonkey Scripts
// @match       https://itch.io/c/*
// @noframes
// @grant       GM_setClipboard
// @run-at      document-start
// @version     1.0
// @author      TheDcoder
// @description Started working on 19 Jun 2020, 16:10 PM
// ==/UserScript==

document.addEventListener("keydown", event => {
    if (!event.ctrlKey || !event.shiftKey || event.key.toLowerCase() != 'c') return;
    event.stopPropagation();
    event.preventDefault();
    
    var elements = document.getElementsByClassName('game_thumb');
    var urls = [];
    for (let element of elements) urls.push(element.dataset.background_image);
    
    var url_count = urls.length;
    urls = urls.join('\n');
    
    GM_setClipboard(urls);
    
    alert(`Copied ${url_count} URL(s) to your clipboard`);
}, {capture: true});

alert("Itch.io Collection Game Cover Copier, use Ctrl+Shift+C to copy all URLs");

https://violentmonkey.github.io/

 

Edited by TheSaint

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...