Newbie: remove one parameter from url in rss output

Hi,
I am scraping a forum in order to create an rss, and I need to remove one parameter (sid) and its value from the url.

The original url is like this:
http://forum.domain.com/viewtopic.php?f=17&t=000000&sid=abc123

I set this pseudo url:
http://forum.domain.com/viewtopic.php?f=17&t=[.+]

This is my page function:

  async function pageFunction(context) {
    const { $, request, log } = context;
    const title = $('title').text();
    log.info(`URL: ${request.url} TITLE: ${title}`);
    var result = context.request.url.match(/.*&t=([^&]*)&.*/)
    return {
        link: request.url,
        guid: result,
        title
    };
}

Actually I get the original url but i would like to get only one like this (removing “sid” parameter)
http://forum.domain.com/viewtopic.php?f=17&t=000000

Many thanks for help.

Hi @massj,

I think you can omit sid from URL simple with reqexp.
There is an example how you can do it:

async function pageFunction(context) {
    const { $, request, log } = context;
    const title = $('title').text();
    log.info(`URL: ${request.url} TITLE: ${title}`);
    const result = context.request.url.match(/.*&t=([^&]*)&.*/);
    const urlWithoutSid = request.url.replace(/&sid=[^&]*/, '');
    return {
        link: urlWithoutSid,
        guid: result,
        title
    };
}

It worked, Many Many thanks!