Skip to content

Commit

Permalink
notes/figures: Fixed image scraping to reflect new MFC image API
Browse files Browse the repository at this point in the history
MFC has changed their image API for the 2nd time since starting this article by
appending a hash key of unknown origin to their image filenames. I have to
assume it's random, this key is unique to every entry but is the same for every
image within the entry.

thumbnail endpoints
https://static.myfigurecollection.net/upload/items/1335582.jpg
https://static.myfigurecollection.net/upload/items/0/1335582-45071.jpg

medium size image endpoints
https://static.myfigurecollection.net/upload/items/big/1335582.jpg
https://static.myfigurecollection.net/upload/items/1/1335582-45071.jpg

Endpoints for */large/* images has been changed to */2/*, but some very old
entries don't have this size of image and I don't feel like making an
XMLHttpRequest for every single entry to check, nor do I want to hardcode it
into the script so I still use the new equivalent endpoint for */big/*.

(for future reference)
* i don't recommend this ham fisted approach i'm just lazy
* fetched the new keys with
	cat figs.txt | while read -r id; do
		wget -qO- "https://myfigurecollection.net/item/$id" \
			| egrep -o "$id-[a-z0-9]+" | head -n 1
	done
* then did something like
	paste figs.txt figs2.txt | while read -r old new; do
		sed "s/$old/$new/g" -i .src/notes/figures.md
	done
* then used nano keystroke macros to massage the rest into JSON i forgot
  • Loading branch information
microsounds committed Feb 23, 2023
1 parent 7426a3d commit 10c49ea
Show file tree
Hide file tree
Showing 2 changed files with 138 additions and 130 deletions.
134 changes: 69 additions & 65 deletions .src/notes/figures.md
Expand Up @@ -15,8 +15,7 @@ Since I don't feel like actually making an account on _[myfigurecollection.net][
[mfc]: https://myfigurecollection.net

## Collection
_Sorted by when I remember getting it, from newest to oldest.<br/>
If images are broken it means MFC is down again._
_Sorted by when I remember getting it, from newest to oldest._

<div id="fig-thumbs">
<noscript>
Expand All @@ -32,8 +31,8 @@ If images are broken it means MFC is down again._

| Key | Meaning |
| -- | -- |
| ![ico-fig](https://static.myfigurecollection.net/upload/items/186.jpg) | **Owned** |
| ![ico-fig-fake](https://static.myfigurecollection.net/upload/items/186.jpg) | **Owned (Fake/Bootleg)** |
| ![ico-fig](https://static.myfigurecollection.net/upload/items/0/186-f9170.jpg) | **Owned** |
| ![ico-fig-fake](https://static.myfigurecollection.net/upload/items/0/186-f9170.jpg) | **Owned (Fake/Bootleg)** |

</div>

Expand Down Expand Up @@ -91,73 +90,76 @@ _(I keep this gallery around mostly so I can gawk at people's gigantic miku coll
'use strict';

var figs = [
/* MFC ids prepended with x are knockoffs */
/* MFC id, unknown MFC image hash key, alt text description
* MFC ids prepended with x are knockoffs
*/

/*
[ '1536230', 're-ment miku miku ♪ room miniature #1 of 8' ],
[ '1536252', 're-ment miku miku ♪ room miniature #2 of 8' ],
[ '1536231', 're-ment miku miku ♪ room miniature #3 of 8' ],
[ '1536233', 're-ment miku miku ♪ room miniature #4 of 8' ],
[ '1536234', 're-ment miku miku ♪ room miniature #5 of 8' ],
[ '1536236', 're-ment miku miku ♪ room miniature #6 of 8' ],
[ '1536237', 're-ment miku miku ♪ room miniature #7 of 8' ],
[ '1536238', 're-ment miku miku ♪ room miniature #8 of 8' ],
[ '1536230', '57dd2', 're-ment miku miku ♪ room miniature #1 of 8' ],
[ '1536252', '08790', 're-ment miku miku ♪ room miniature #2 of 8' ],
[ '1536231', '9277b', 're-ment miku miku ♪ room miniature #3 of 8' ],
[ '1536233', '7ee99', 're-ment miku miku ♪ room miniature #4 of 8' ],
[ '1536234', '4c1f3', 're-ment miku miku ♪ room miniature #5 of 8' ],
[ '1536236', '79c77', 're-ment miku miku ♪ room miniature #6 of 8' ],
[ '1536237', 'c53b8', 're-ment miku miku ♪ room miniature #7 of 8' ],
[ '1536238', '0e4a2', 're-ment miku miku ♪ room miniature #8 of 8' ],
*/
[ '1335582', 'sega sakura miku v3 SPM' ],
[ '1571286', 'sega miku christmas 2022 SPM' ],
[ '1479579', 'sega miku 15th anniversary kei ver. SPM' ],
[ '1549222', 'sega miku 15th anniversary zhou ver. SPM' ],
[ '1275355', 'sega preciality special nuigurumi sakura miku' ],
[ '1213389', 'good smile genshin impact venti nendoroid #1795' ],
[ '1189088', 'good smile hatsune miku nt nendoroid #1701' ],
[ '1499800', 'taito miku artist masterpiece latidos 2022 ver.' ],
[ '1220581', 'taito miku artist masterpiece pricess arabian ver.' ],
[ 'x1214387', 'knockoff taito miku wonderland rapunzel' ],
[ 'x314683', 'knockoff sega miku fuwa fuwa nuigurumi plush (strap)' ],
[ 'x370088', 'knockoff sega miku fuwa fuwa mega jumbo nuigurumi plush' ],
[ 'x514129', 'knockoff sega nyanko miku fuwa fuwa mega jumbo nuigurumi plush' ],
[ 'x809190', 'knockoff furyu miku noodle stopper figure' ],
[ 'x2987', 'knockoff max factory figma miku #014' ],
[ '401018', 'sega project diva innocent SPM miku' ],
[ '718192', 'hatsune miku 2nd season Winter ver.' ],
[ '1251026', 'bandai q posket miku type a' ],
[ '944728', 'furyu miku bicute bunnies' ],
[ '1311067', 'taito miku artist masterpiece princess alice' ],
[ '1268909', 'taito miku artist masterpiece 14th anniv.' ],
[ '1293291', 'furyu sakura miku noodle stopper' ],
[ '886807', 'taito sakura miku 2020 ver.' ],
[ '1216990', 'racing miku 2021 espresto' ],
[ '1035745', "sega mega 39's breathe you SPM miku" ],
[ '1112719', 'miku big nuigurumi plush' ],
[ '756832', 'hatsune miku 2nd season Spring ver.' ],
[ '776143', 'hatsune miku 2nd season Summer ver.' ],
[ '4741', 'hatsune miku piano EX figure 2009' ],
[ '1150601', 'miku nesoberi nuigurumi (strap)' ],
[ '798190', 'sega sakura miku SPM' ],
[ '720383', 'sega fate/extella link astolfo SPM' ],
[ '693275', 'miku mega jumbo nuigurumi plush 2018' ],
[ '675904', 'good smile gochiusa sxarp nendoroid #929' ],
[ '689123', 'good smile snow princess miku nendoroid #1000' ],
[ '464596', 'good smile konosuba megumin nendoroid #725' ],
[ '440687', 'sega project diva X SPM miku' ],
[ '583734', 'sega izayoi sakuya prize figure' ],
[ '200768', 'funko pop rocks miku #39' ],
[ '246546', 'sega project diva F2nd miku' ],
[ 'x287774', 'knockoff good smile umaru-chan nendoroid #524' ],
[ 'x26113', 'knockoff good smile snow miku nendoroid #150' ],
[ '198604', 'sega project diva 2nd miku' ],
[ '47413', 'banpresto kogami akira lucky star' ],
[ '167123', 'sega project diva arcade miku 2012' ],
[ '100292', 'hatsune miku plush great eastern 2012' ],

[ '1335582', '45071', 'sega sakura miku v3 SPM' ],
[ '1571286', '13885', 'sega miku christmas 2022 SPM' ],
[ '1479579', '2b77d', 'sega miku 15th anniversary kei ver. SPM' ],
[ '1549222', '51878', 'sega miku 15th anniversary zhou ver. SPM' ],
[ '1275355', '6d5f6', 'sega preciality special nuigurumi sakura miku' ],
[ '1213389', 'b3aa1', 'good smile genshin impact venti nendoroid #1795' ],
[ '1189088', '749c7', 'good smile hatsune miku nt nendoroid #1701' ],
[ '1499800', '5eb8d', 'taito miku artist masterpiece latidos 2022 ver.' ],
[ '1220581', '68abc', 'taito miku artist masterpiece pricess arabian ver.' ],
[ 'x1214387', '2ce6c', 'knockoff taito miku wonderland rapunzel' ],
[ 'x314683', 'dd714', 'knockoff sega miku fuwa fuwa nuigurumi plush (strap)' ],
[ 'x370088', '9e436', 'knockoff sega miku fuwa fuwa mega jumbo nuigurumi plush' ],
[ 'x514129', '953bd', 'knockoff sega nyanko miku fuwa fuwa mega jumbo nuigurumi plush' ],
[ 'x809190', 'f14f9', 'knockoff furyu miku noodle stopper figure' ],
[ 'x2987', '316e0', 'knockoff max factory figma miku #014' ],
[ '401018', '46ea9', 'sega project diva innocent SPM miku' ],
[ '718192', '46a35', 'hatsune miku 2nd season Winter ver.' ],
[ '1251026', '4cdac', 'bandai q posket miku type a' ],
[ '944728', 'e11c7', 'furyu miku bicute bunnies' ],
[ '1311067', '71abf', 'taito miku artist masterpiece princess alice' ],
[ '1268909', '1026e', 'taito miku artist masterpiece 14th anniv.' ],
[ '1293291', '0722b', 'furyu sakura miku noodle stopper' ],
[ '886807', '361bd', 'taito sakura miku 2020 ver.' ],
[ '1216990', 'd5032', 'racing miku 2021 espresto' ],
[ '1035745', '30ee2', "sega mega 39's breathe you SPM miku" ],
[ '1112719', '9eef3', 'miku big nuigurumi plush' ],
[ '756832', 'e2f87', 'hatsune miku 2nd season Spring ver.' ],
[ '776143', '83ba8', 'hatsune miku 2nd season Summer ver.' ],
[ '4741', 'b8f3f', 'hatsune miku piano EX figure 2009' ],
[ '1150601', 'e3581', 'miku nesoberi nuigurumi (strap)' ],
[ '798190', '976e1', 'sega sakura miku SPM' ],
[ '720383', '9fd05', 'sega fate/extella link astolfo SPM' ],
[ '693275', '0efa8', 'miku mega jumbo nuigurumi plush 2018' ],
[ '675904', '9186d', 'good smile gochiusa sxarp nendoroid #929' ],
[ '689123', 'a8cdd', 'good smile snow princess miku nendoroid #1000' ],
[ '464596', '0159f', 'good smile konosuba megumin nendoroid #725' ],
[ '440687', '03e24', 'sega project diva X SPM miku' ],
[ '583734', 'a013e', 'sega izayoi sakuya prize figure' ],
[ '200768', '787a5', 'funko pop rocks miku #39' ],
[ '246546', '3a64c', 'sega project diva F2nd miku' ],
[ 'x287774', '7757e', 'knockoff good smile umaru-chan nendoroid #524' ],
[ 'x26113', '16c9a', 'knockoff good smile snow miku nendoroid #150' ],
[ '198604', '17661', 'sega project diva 2nd miku' ],
[ '47413', 'fbbec', 'banpresto kogami akira lucky star' ],
[ '167123', 'b82e3', 'sega project diva arcade miku 2012' ],
[ '100292', '62674', 'hatsune miku plush great eastern 2012' ],
];

var thumbs = document.getElementById('fig-thumbs');
var gallery = document.getElementById('fig-gallery');

for (var i in figs) {
var id = figs[i][0];
var title = figs[i][1];
var hash = figs[i][1];
var title = figs[i][2];
var alt = 'ico-fig';
if (id.charAt(0) == 'x') {
id = id.slice(1);
Expand All @@ -168,12 +170,13 @@ for (var i in figs) {

/* icons */
l1 = document.createElement('a');
l1.href= "https://myfigurecollection.net/item/" + id;
l1.href= 'https://myfigurecollection.net/item/' + id;

l2 = document.createElement('img');
l2.alt = alt;
l2.title = title;
l2.src = "https://static.myfigurecollection.net/upload/items/" + id + ".jpg";
l2.src = 'https://static.myfigurecollection.net/upload/items/0/'
+ id + '-' + hash + ".jpg";
l1.appendChild(l2);

thumbs.appendChild(l1);
Expand All @@ -182,10 +185,11 @@ for (var i in figs) {
l1 = document.createElement('p');

l2 = document.createElement('a');
l2.href = "https://myfigurecollection.net/pictures.php?itemId=" + id;
l2.href = 'https://myfigurecollection.net/pictures.php?itemId=' + id;

l3 = document.createElement('img');
l3.src = "https://static.myfigurecollection.net/upload/items/big/" + id + ".jpg";
l3.src = 'https://static.myfigurecollection.net/upload/items/1/'
+ id + '-' + hash + ".jpg";
l3.title = title;
l3.alt = 'nolink';
l2.appendChild(l3);
Expand Down
134 changes: 69 additions & 65 deletions notes/figures.htm

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 10c49ea

Please sign in to comment.