Skip to content

Commit

Permalink
Create scrapePixieset.js
Browse files Browse the repository at this point in the history
  • Loading branch information
mattgt933 authored Nov 5, 2024
1 parent 3999869 commit beca631
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions scrapePixieset.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const axios = require('axios');
const cheerio = require('cheerio');
const fs = require('fs');

const pixiesetURL = 'https://matthewthomas.pixieset.com/bestphotos/';

async function scrapePixiesetImages() {
try {
const { data } = await axios.get(pixiesetURL);
const $ = cheerio.load(data);
const imageUrls = [];

$('img').each((index, element) => {
const src = $(element).attr('src');
if (src) imageUrls.push(src);
});

fs.writeFileSync('imageLinks.json', JSON.stringify(imageUrls, null, 2));
console.log('Image URLs saved to imageLinks.json');
} catch (error) {
console.error('Error scraping Pixieset images:', error);
}
}

scrapePixiesetImages();

0 comments on commit beca631

Please sign in to comment.