|
|
|
@ -24,7 +24,9 @@ app.post('/convertGalleryToHar', async (req, res) => {
|
|
|
|
console.log(url);
|
|
|
|
console.log(url);
|
|
|
|
|
|
|
|
|
|
|
|
// get processor
|
|
|
|
// get processor
|
|
|
|
const processor = _.find(processors, (processor) => ((new URL(url)).hostname) === (processor.baseUrl));
|
|
|
|
const searchableHostname = (new URL(url)).hostname.replace(/^www\./i, '');
|
|
|
|
|
|
|
|
console.log('Searching for hostname:', searchableHostname)
|
|
|
|
|
|
|
|
const processor = _.find(processors, (processor) => (searchableHostname) === (processor.baseUrl.replace(/^www\./i, '')));
|
|
|
|
if (!processor) {
|
|
|
|
if (!processor) {
|
|
|
|
return res.status(400).json({
|
|
|
|
return res.status(400).json({
|
|
|
|
message: 'Could not find processor for url'
|
|
|
|
message: 'Could not find processor for url'
|
|
|
|
@ -56,6 +58,11 @@ async function run(url, processor) {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
const page = await browser.newPage();
|
|
|
|
const page = await browser.newPage();
|
|
|
|
|
|
|
|
await page.setViewport({
|
|
|
|
|
|
|
|
width: 1200,
|
|
|
|
|
|
|
|
height: 800
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
await page.setUserAgent("Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36");
|
|
|
|
console.log('Loading page...');
|
|
|
|
console.log('Loading page...');
|
|
|
|
await page.goto(url, { timeout: 60000 });
|
|
|
|
await page.goto(url, { timeout: 60000 });
|
|
|
|
console.log('page loaded')
|
|
|
|
console.log('page loaded')
|
|
|
|
|