flickr photostream template downloading all sizes of each picture

Post Reply
iamanepfuser
Posts: 35
Joined: 29 Mar 2019, 21:17

flickr photostream template downloading all sizes of each picture

Post by iamanepfuser » 23 Oct 2019, 03:20

template is downloading each size (*_k.jpg, *_b.jpg, *_h.jpg, *_o.jpg) available

https://www.flickr.com/photos/84773061@N08/

200 pictures in photostream, 800 pictures downloaded

https://www.flickr.com/photos/144881785@N08/

13 pictures in photostream, 46 pictures downloaded

Maksym
Site Admin
Posts: 2077
Joined: 02 Mar 2009, 17:02

Re: flickr photostream template downloading all sizes of each picture

Post by Maksym » 23 Oct 2019, 12:43

Yes, currently I see no way of filtering them automatically. Some photostreams have all sizes, some have only small pics and if I leave only big pics in the template, then some photostreams will produce no downloads at all. So I'm open for any suggestions on this matter.

iamanepfuser
Posts: 35
Joined: 29 Mar 2019, 21:17

Re: flickr photostream template downloading all sizes of each picture

Post by iamanepfuser » 23 Oct 2019, 17:15

I also use Image Host Grabber through my browser (Waterfox or any Fox variant) and it will grab the largest size available however it will only grab from the current page and not the entire photostream like EPF will. Could that be of help?

https://imagehostgrabber.com/forum/index.php

flickr Host File for IHG

URL Pattern:

Code: Select all

^https?:\/\/([^/]+\.)?flickr\.com\/photos\/[^/]+\/\d+(\/in\/explore-[^/]+)?(((?!\/#).)*)$
Search Pattern:

Code: Select all

function(pageData, pageUrl) {
	var retVal = {imgUrl: null, fileName: null, status: "ABORT"};
	var sizes = pageData.match(/"sizes":{.+?}}/);
	if (sizes) {
		var url = sizes[0].match(/"url":"[^"]+/ig);
		if (url) {
			var iUrl = url[url.length - 1].replace(/\\/g, '').substring(7);
			retVal.imgUrl = iUrl;
			retVal.status = "OK";
			//
			// Select the type of filename by setting the value of nameType:
			// 1: image title
			// 2: name on the host + image title
			// 3: image title + name on the host
			// else: name on the host
			const nameType = 2;  // <-- edit this number; default: 2
			//
			if (nameType == 1 || nameType == 2 || nameType == 3) {
				var iName = (pageData.match(/property\s*=\s*('|")og:title\1\s*content\s*=\s*('|")(.*?)\2/i)||[])[3];
				if (iName) { // exists and is not empty
					iName = iName.replace(/&quot;/g, '\'');
					iName = iName.replace(/[\\/|]/g, ' ');  // replace backslash, slash, pipe by space
					iName = iName.replace(/[:*?"<>]/g, '');  // remove invalid characters
					iName = iName.replace(/\s+/g, ' ');  // compress whitespace
					iName = iName.trim();  // remove leading and trailing whitespaces
					iName = iName.replace(/\s/g, '_');  // replace all whitespaces by underscores
					if (nameType == 2 || nameType == 3) {
						let filename = iUrl.split('?')[0].split('/').pop();
						let fnparts = filename.match(/([^/]+?)(\.([^./]+))?$/)||[];
						let basefn = fnparts[1]||'';
						let dotext = fnparts[2]||'';
						if (nameType == 2) iName = basefn + '_' + iName + dotext;
						if (nameType == 3) iName = iName + '_' + basefn + dotext;
					}
				}
			}
			retVal.fileName = iName;
		}
	}
	return retVal;
}
(I don't know how any of this works (EPF or IHG). It all seems like magic to me and I'm just glad it works and I just go on my merry way downloading pictures.)

Maksym
Site Admin
Posts: 2077
Joined: 02 Mar 2009, 17:02

Re: flickr photostream template downloading all sizes of each picture

Post by Maksym » 23 Oct 2019, 18:11

Well, they can cycle through all available sizes and select the biggest one for every image, while EPF unfortunately cannot :( It can just grab them all with the current way flickr generates their pages. Should they change the way they do it - maybe EPF will be able to parse out only the biggest image size available.

Post Reply