Skip to content

Commit

Permalink
dep updates
Browse files Browse the repository at this point in the history
  • Loading branch information
simpixelated committed May 10, 2021
1 parent a9860a9 commit 6e2c195
Show file tree
Hide file tree
Showing 3 changed files with 32,413 additions and 7,594 deletions.
45 changes: 26 additions & 19 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,34 @@
const fs = require('fs');
const Flickr = require('flickr-sdk');
const init = async (flickrApiKey) => {
const flickr = new Flickr(flickrApiKey);
const flickr = new Flickr(process.env.FLICKR_API_KEY);

// get list of users from a gallery
const getUserIdsFromGalleryById = async (gallery_id) => {
try {
const response = await flickr.galleries.getPhotos({ gallery_id });
return response.body.photos.photo.map(photo => photo.owner);
} catch (err) {
console.error('bonk', err);
}
// get public favorites by user id
const getPublicFavoritesForUser = async (params) => {
try {
const response = await flickr.favorites.getPublicList(params)
return response.body.photos.photo
} catch (err) {
console.error('bonk', err);
}
}

// get public favorites by user id
const getPublicFavoritesForUser = async (params) => {
try {
const response = await flickr.favorites.getPublicList(params)
return response.body.photos.photo
} catch (err) {
console.error('bonk', err);
}
// get list of users from a gallery
const getUserIdsFromGalleryById = async (gallery_id) => {
try {
const response = await flickr.galleries.getPhotos({ gallery_id });
return response.body.photos.photo.map(photo => photo.owner);
} catch (err) {
console.error('bonk', err);
}
}

const outputTweets = async (user_id) => {
(await getPublicFavoritesForUser({ user_id })).forEach(fave => {
console.log(fave)
})
}

const init = async (flickrApiKey) => {
// get photos from the last N days -- change 6 to however many days you want (may be limited by Flickr API)
const min_fave_date = new Date().setDate(new Date().getDate() - 6) / 1000;
const userIds = await getUserIdsFromGalleryById(process.env.FLICKR_GALLERY_ID);
Expand All @@ -36,4 +42,5 @@ const init = async (flickrApiKey) => {
});
};

init(process.env.FLICKR_API_KEY);
// init();
outputTweets('38375540@N08')
Loading

0 comments on commit 6e2c195

Please sign in to comment.