This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function extractRowData(rowElement) { | |
// Function to extract text or attribute from an element if it exists | |
function getElementData(selector, attribute = 'text') { | |
const element = rowElement.querySelector(selector); | |
if (!element) return null; | |
if (attribute === 'text') return element.textContent.trim(); | |
return element.getAttribute(attribute); | |
} | |
// Extracting the values based on their aria-label, role, or data-* attributes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
// Initialize an array to hold the conversation data | |
let conversationData = []; | |
// Select all conversation blocks | |
let conversationBlocks = document.querySelectorAll('[data-testid^="conversation-turn"]'); | |
conversationBlocks.forEach(block => { | |
// Determine the role directly from data attributes in the HTML | |
let roleElement = block.querySelector('[data-message-author-role]'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Updated extractLinkedInPosts function with continuous scrolling | |
async function extractLinkedInPosts() { | |
const postsData = []; | |
const seenTexts = new Set(); | |
let lastLength = 0; | |
while (postsData.length < 20) { | |
window.scrollTo(0, document.body.scrollHeight); | |
await new Promise(resolve => setTimeout(resolve, 2000)); // Wait for more posts to load |
NewerOlder