npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@garaekz/inscraper

v2.1.5

Published

A LinkedIn voyager wrapper for scraping data from LinkedIn profiles. We'll be using Playwright as a fallback and for some other functionalities.

Downloads

3

Readme

InScraper

~~### A playwright based LinkedIn based scraper~~

A voyager API based LinkedIn wrapper

This is (currently) a small library built in typescript in order to scrape LinkedIn profiles using the vanity URL (slug or custom URL) using the voyager API ~~Playwright and Cheerio~~.

I'm trying to stick to semver but I'm not sure if I'm doing it right, so please be aware that this library is still in development and the API may change.

Update: I have decided to let go Playwright and Cheerio and use the voyager API instead, I'll try to add this again in future releases but currently was getting messy and got a lot of timeouts.

Why?

I was looking for a way to get some information from LinkedIn profiles and I found that there are some libraries that do that, but they are not maintained anymore and they use Puppeteer, which is a bit slow and heavy. I wanted to try Playwright, which is a new library that is built on top of Chromium, Firefox and Webkit, so it's faster and lighter than Puppeteer. I also wanted to try to use TypeScript, so I decided to build this library. I hope you find it useful.

Disclaimer

This library is provided as is, without any warranty. I am not responsible for any misuse of this library. Please be aware that web scraping may be against the terms of service of LinkedIn, try to use a side account because it may get you banned (haven't see that yet but could be).

Installation

npm install inscraper

Using Yarn:

 yarn add inscraper

Usage

To use the library, you will need to provide a valid LinkedIn cookie. You can obtain this by logging into LinkedIn and inspecting the cookies in your browser, search for the one called li_at. Once you have the cookie, you can pass it to the createClient function, which will return an instance of the VoyagerClient class.

import { createClient } from  'inscraper';

const cookieString = 'YOUR_COOKIE_HERE';
const client = await  createClient(cookieString);

The VoyagerClient class has the following methods:

  • getProfile(slug: string): Returns the profile information of the user with the given profile slug, including their name, headline, about and experience sections.

~~- getExperience(slug: string): Returns only the experience of the user with the given profile slug.~~

~~- getScreenshot(): You can use this method to get a screenshot of the current page. This is useful if you want to see what the page looks like after you have performed some actions. It only works if you have called the getProfile or getExperience methods before. It's built on top of Playwright's screenshot method, so you can pass the same options to it. See Playwright's documentation for more information.~~

Get some profile info:

const profile = await client.getProfile('profile-slug');
console.log(profile);

Note that if the provided cookie is invalid, the library will throw an error, 'Cookies error'

Full Example

import fs from "fs";
import { createClient } from "inscraper/client";

const cookieString = 'YOUR_COOKIE_HERE';
const client = await createClient(cookieString);

const slug = 'profile-slug';

const profile = await client.getProfile(slug);
console.log(profile);

Compatibility

~~This library uses Playwright, which is compatible with Chromium, Firefox and Webkit. For this implementation, Chromium is being used.~~ Planing to add this again in future releases

Dependencies

~~This library depends on playwright and cheerio~~.

Contributions

Your contributions are always welcome! Please feel free to submit a pull request or open an issue.

Features

  • [x] Work with Cookies
  • [x] Get basic info from Profile
  • [x] Get Experience from Profile
  • [x] Get Education from Profile
  • [x] Get Skills from Profile
  • [ ] Get Recommendations from Profile
  • [ ] Get Screenshots of a visited profile
  • [x] Extend it to try and use voyager API (see if that's still a thing)
  • [ ] Add a test suite
  • [ ] Add more features to this list
  • [ ] Check if people like this and work on people recommendations 😅

License

This library is provided under the MIT License.

Contact

Please feel free to contact me if you have any questions or issues.