Fix: Sell2Wales direct URL to use search_view.aspx with ID parameter
This commit is contained in:
@@ -67,16 +67,16 @@ async function scrapeTenders() {
|
|||||||
const title = link.text().trim();
|
const title = link.text().trim();
|
||||||
if (!title || title.length === 0) continue;
|
if (!title || title.length === 0) continue;
|
||||||
|
|
||||||
const noticeUrl = release.url || ('https://sell2wales.gov.wales/Search/notice/' + sourceId);
|
// Extract reference number from URL first
|
||||||
|
const idMatch = href.match(/ID=([A-Z0-9]+)/);
|
||||||
|
const sourceId = idMatch ? idMatch[1] : ('s2w_' + Date.now() + '_' + i);
|
||||||
|
|
||||||
|
const noticeUrl = 'https://sell2wales.gov.wales/search/search_view.aspx?ID=' + sourceId;
|
||||||
|
|
||||||
// Get the parent container for this tender
|
// Get the parent container for this tender
|
||||||
const container = link.closest('div, li, tr');
|
const container = link.closest('div, li, tr');
|
||||||
const containerText = container.text();
|
const containerText = container.text();
|
||||||
|
|
||||||
// Extract reference number from URL
|
|
||||||
const idMatch = href.match(/ID=([A-Z0-9]+)/);
|
|
||||||
const sourceId = idMatch ? idMatch[1] : ('s2w_' + Date.now() + '_' + i);
|
|
||||||
|
|
||||||
// Extract metadata
|
// Extract metadata
|
||||||
const refMatch = containerText.match(/Reference no:\s*([A-Z0-9]+)/i);
|
const refMatch = containerText.match(/Reference no:\s*([A-Z0-9]+)/i);
|
||||||
const finalRef = refMatch ? refMatch[1] : sourceId;
|
const finalRef = refMatch ? refMatch[1] : sourceId;
|
||||||
|
|||||||
Reference in New Issue
Block a user