Here is a Chrome bookmarklet for scraping Bing Search Results.
Code:
// Create an empty array to store the data
const data = [];
// Select all the search result links and titles
const searchResults = document.querySelectorAll('.b_algo h2 a');
// Loop through each search result and extract the link and title
for (let i = 0; i < searchResults.length; i++) {
const link = searchResults[i].href;
const title = searchResults[i].textContent;
// Add the extracted data to the data array
data.push([link, title]);
}
// Create a table element and populate it with the data
const table = document.createElement('table');
for (let i = 0; i < data.length; i++) {
const row = table.insertRow();
const linkCell = row.insertCell();
linkCell.textContent = data[i][0];
const titleCell = row.insertCell();
titleCell.textContent = data[i][1];
}
// Add the table to a temporary element and select it
const tempEl = document.createElement('div');
tempEl.appendChild(table);
document.body.appendChild(tempEl);
const textarea = document.createElement('textarea');
textarea.value = table.innerText;
document.body.appendChild(textarea);
textarea.select();
// Copy the table to the clipboard
document.execCommand('copy');
// Remove the temporary elements
document.body.removeChild(textarea);
document.body.removeChild(tempEl);
// Log a success message
console.log('Table copied to clipboard!');