Note: I have made this to work in firefox, someone else can modify it to work in other browsers
When on iNat, open the browser console and enter this (insert your username where it says your username here):
async function getFavesBatch(userId, page = 1) {
const response = await fetch(`https://www.inaturalist.org/faves/${userId}?page=${page}`);
const text = await response.text();
const parser = new DOMParser();
const doc = parser.parseFromString(text, 'text/html');
const observations = doc.getElementsByClassName('observation');
const list = [];
for (let obs of observations) {
list.push(obs.id.replace('observation-', ''));
}
const navigationChildren = doc.querySelector('[role=navigation]')?.children;
const maxBatch = navigationChildren ? parseInt(navigationChildren[navigationChildren.length - 2].innerText, 10) : 1;
if (page === 1) {
console.log(`Total pages: ${maxBatch}`);
}
return { obsList: list, maxPage: maxBatch };
}
async function fetchAllFavorites(userId) {
let obsList = [];
let maxPage = 1;
for (let i = 1; i <= maxPage; i++) {
const batchData = await getFavesBatch(userId, i);
obsList.push(...batchData.obsList);
maxPage = batchData.maxPage;
console.log(`Extracted page ${i}`);
}
console.log(obsList.join(','));
}
// Call the function with the specific user ID
fetchAllFavorites('your username here');
This will return back a list of observation id’s
Copy that list and paste it in front of https://www.inaturalist.org/observations?id=