
Scrape LinkedIn data using React with Axios and Cheerio.
By the way, we're Bardeen, we build a free AI Agent for doing repetitive tasks.
If you're scraping LinkedIn, try our LinkedIn Data Scraper. Automate data extraction with no code.
Web scraping has become an essential tool for data collection, and LinkedIn, with its vast network of professionals, offers valuable insights for businesses and researchers alike. In this tutorial, we'll guide you through the process of scraping LinkedIn data using React, a popular JavaScript library known for its flexibility and performance. By leveraging React's components and state management capabilities, you'll learn how to build an efficient and user-friendly web scraping tool specifically tailored for LinkedIn.
Web scraping is the process of extracting data from websites, and LinkedIn, with its vast network of professionals, offers valuable insights for businesses and researchers. React, a popular JavaScript library, provides a practical and efficient way to develop scraping tools for LinkedIn data collection.

Here are some key points to understand about LinkedIn data scraping with React:
When scraping LinkedIn data, it's crucial to respect LinkedIn's terms of service and adhere to ethical scraping practices. This includes avoiding excessive requests, properly handling rate limits, and ensuring that your scraping activities do not violate any legal or privacy regulations.
React, in combination with libraries like Axios for making HTTP requests and Cheerio for parsing HTML, provides a powerful toolset for building robust LinkedIn scraping applications. With React's flexibility and performance, you can create efficient and maintainable scraping tools tailored to your specific data collection needs.
To set up your React environment for web scraping, you'll need to create a new React project and install the necessary dependencies. Here's a step-by-step guide to web scraping:
create-react-app or a custom setup with Webpack and Babel.npm install axios cheerio
const axios = require('axios');axios.defaults.headers.common['User-Agent'] = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.82 Safari/537.36';
Handling cookies is also crucial for maintaining session persistence across requests. Axios automatically handles cookies by default, so you don't need to configure anything extra.
With these steps completed, your React environment is now set up for web scraping. You can start writing your scraping logic using Axios for making requests and Cheerio for parsing the HTML responses.
Use Bardeen to save time scraping. Automate tasks with no code required.
When scraping LinkedIn data using React, managing authentication and maintaining session persistence are crucial for accessing user-specific information. Here's how you can implement authentication and session handling:
To ensure session persistence across multiple scraping sessions, you can:
By properly handling authentication and session persistence, you can ensure that your React app can access user-specific data from LinkedIn without the need for repeated login prompts.
When scraping LinkedIn data, navigating the site's structure and extracting specific data points is crucial. React components can be used to target and extract data from user profiles, job listings, and company pages. Here's how you can navigate and extract data using React and Axios:
ProfileScraper, JobScraper, or CompanyScraper component.Here's an example of using Axios to fetch data from a LinkedIn profile page:
import axios from 'axios';
// ...
const fetchProfileData = async (profileUrl) => { try { const response = await axios.get(profileUrl); const html = response.data; // Parse the HTML and extract desired data using Cheerio or regular expressions // ... return extractedData; } catch (error) { console.error('Error fetching profile data:', error); return null; } };
By leveraging the power of React components and Axios, you can efficiently navigate LinkedIn's structure, extract specific data points, and handle pagination to ensure comprehensive data collection.
Save time scraping data with Bardeen. Try ourLinkedIn scraper to automate tasks with no code.
When scraping data from LinkedIn using React, parsing the fetched HTML content and storing the extracted data efficiently are crucial steps. Cheerio, a popular library for parsing HTML, plays a significant role in this process.
Cheerio allows you to traverse and manipulate the fetched HTML content using a syntax similar to jQuery. With Cheerio, you can easily select specific elements, extract their text or attributes, and build structured data objects from the parsed information.

Here's an example of using Cheerio to parse LinkedIn profile data:
const cheerio = require('cheerio');
const parseProfileData = (html) => {
const $ = cheerio.load(html);
const name = $('h1.name').text().trim();
const title = $('p.headline').text().trim();
const location = $('span.location').text().trim();
return {
name,
title,
location
};
};
After parsing the data, you need to consider storage solutions to persist the scraped information. The choice of storage depends on your specific requirements, such as data volume, querying needs, and scalability.
Some common storage options for scraped data include:
When working with React, you can utilize state management libraries like React Context or Redux to manage the scraped data within your application. These libraries provide a centralized store to hold the data and allow easy access and updates across different components.
For example, using React Context, you can create a scraping context to store and manage the scraped data:
import React, { createContext, useState } from 'react';
export const ScrapingContext = createContext();
export const ScrapingProvider = ({ children }) => {
const [scrapedData, setScrapedData] = useState([]);
const addScrapedData = (data) => {
setScrapedData([...scrapedData, data]);
};
return (
<ScrapingContext.Provider value=>
{children}
</ScrapingContext.Provider>
);
};
By combining Cheerio for parsing and React Context or Redux for state management, you can effectively handle the scraped data within your React application, making it accessible and manageable throughout different components. Bardeen's scraper can help automate the process.
When scraping data from LinkedIn using React, it's crucial to handle rate limiting and avoid getting banned. LinkedIn employs various techniques to detect and block scrapers that make too many requests in a short period.
Here are some strategies to handle LinkedIn's rate limiting:
setTimeout or setInterval to introduce random pauses.To avoid getting banned, follow these ethical scraping practices:
Here's an example of implementing delays and proxies in a React component:
import React, { useEffect } from 'react';import axios from 'axios';const LinkedInScraper = () => {useEffect(() => {const scrapeData = async () => {const proxies = ['proxy1', 'proxy2', 'proxy3'];const userAgents = ['userAgent1', 'userAgent2', 'userAgent3'];for (const url of urlsToScrape) {const randomProxy = proxies[Math.floor(Math.random() * proxies.length)];const randomUserAgent = userAgents[Math.floor(Math.random() * userAgents.length)];try {await axios.get(url, {proxy: randomProxy,headers: {'User-Agent': randomUserAgent,},});// Process the scraped dataawait new Promise((resolve) => setTimeout(resolve, getRandomDelay()));} catch (error) {console.error('Scraping error:', error);// Implement exponential backoff or other error handling}}};scrapeData();}, []);const getRandomDelay = () => {// Generate a random delay between 1000 and 5000 millisecondsreturn Math.floor(Math.random() * 4000) + 1000;};return <div>{/* Render scraped data */}</div>;};export default LinkedInScraper;
By implementing these strategies and being mindful of LinkedIn's rate limits and terms of service, you can scrape data more effectively and reduce the risk of getting banned. Bardeen's LinkedIn integration can help automate the process.
Save time scraping data with Bardeen. Try our LinkedIn scraper to automate tasks with no code.
Creating a user-friendly interface for your LinkedIn scraping tool is essential to make it accessible and easy to use. With React, you can build a dynamic and interactive UI that allows users to input scraping parameters, initiate the scraping process, and view the results.
Here's how you can design a simple user interface using React components:
Here's an example of a basic React component structure for a scraping control UI:
import React, { useState } from 'react';const ScrapingControlUI = () => {const [formData, setFormData] = useState({profileUrl: '',pages: 1,fields: [],});const [isLoading, setIsLoading] = useState(false);const [scrapedData, setScrapedData] = useState(null);const [error, setError] = useState(null);const handleSubmit = async (e) => {e.preventDefault();setIsLoading(true);try {const data = await scrapeLinkedInProfile(formData);setScrapedData(data);setError(null);} catch (error) {setError(error.message);setScrapedData(null);}setIsLoading(false);};return (<div><form onSubmit={handleSubmit}>{/* Form inputs */}<button type="submit" disabled={isLoading}>{isLoading ? 'Scraping...' : 'Start Scraping'}</button></form>{isLoading && <p>Scraping in progress...</p>}{error && <p>Error: {error}</p>}{scrapedData && (<div>{/* Display scraped data */}</div>)}</div>);};export default ScrapingControlUI;
By building a user interface with React, you can provide a seamless and intuitive experience for users to interact with your LinkedIn scraping tool. The UI components handle user input, display progress and error states, and present the scraped data in a structured manner.



SOC 2 Type II, GDPR and CASA Tier 2 and 3 certified — so you can automate with confidence at any scale.
Bardeen is an automation and workflow platform designed to help GTM teams eliminate manual tasks and streamline processes. It connects and integrates with your favorite tools, enabling you to automate repetitive workflows, manage data across systems, and enhance collaboration.
Bardeen acts as a bridge to enhance and automate workflows. It can reduce your reliance on tools focused on data entry and CRM updating, lead generation and outreach, reporting and analytics, and communication and follow-ups.
Bardeen is ideal for GTM teams across various roles including Sales (SDRs, AEs), Customer Success (CSMs), Revenue Operations, Sales Engineering, and Sales Leadership.
Bardeen integrates broadly with CRMs, communication platforms, lead generation tools, project and task management tools, and customer success tools. These integrations connect workflows and ensure data flows smoothly across systems.
Bardeen supports a wide variety of use cases across different teams, such as:
Sales: Automating lead discovery, enrichment and outreach sequences. Tracking account activity and nurturing target accounts.
Customer Success: Preparing for customer meetings, analyzing engagement metrics, and managing renewals.
Revenue Operations: Monitoring lead status, ensuring data accuracy, and generating detailed activity summaries.
Sales Leadership: Creating competitive analysis reports, monitoring pipeline health, and generating daily/weekly team performance summaries.