<commit_before>const express = require('express');
const router = express.Router();
const puppeteer = require('puppeteer');


router.get('/', function (req, res, next) {
  puppeteer.launch().then(async browser => {
    const page = await browser.newPage();
    page.setViewport({
      width: req.param('width') ? parseInt(req.param('width'), 10) : 1024,
      height: req.param('height') ? parseInt(req.param('height'), 10) : 768
    });
    await page.goto(req.query.url, {timeout: 60000});
    const shot = await page.screenshot({});
    await browser.close();
    res.setHeader('Content-Type', 'image/png');
    res.status(200).send(shot);
  }).catch(e => {
    console.error(e);
    res.status(500).send({error: 'Could not take screenshot'});
  });
});

module.exports = router;
<commit_msg>Fix : replace deprecated request.param() api by request.params<commit_after>const express = require('express');
const router = express.Router();
const puppeteer = require('puppeteer');


router.get('/', function (req, res, next) {
  puppeteer.launch().then(async browser => {
    const page = await browser.newPage();
    page.setViewport({
      width: req.params.width ? parseInt(req.params.width, 10) : 1024,
      height: req.params.heigh ? parseInt(req.params.height, 10) : 768
    });
    await page.goto(req.query.url, {timeout: 60000});
    const shot = await page.screenshot({});
    await browser.close();
    res.setHeader('Content-Type', 'image/png');
    res.status(200).send(shot);
  }).catch(e => {
    console.error(e);
    res.status(500).send({error: 'Could not take screenshot'});
  });
});

module.exports = router;

{'fraction_non_alphanumeric': 0.18443627450980393, 'fraction_numerical': 0.02696078431372549, 'mean_word_length': 3.9484848484848483, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7180333', 'n_tokens_mistral': 559, 'n_tokens_neox': 523, 'n_words': 112}