gcleaves / linktree-scraper

NPM library for scraping data from a linktree page

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Linktree Profile Scraper

This library helps you pull the links/socials from a linktree profile. This is by no means an official tool and could break by any code changes from the Linktree team.

Use of this library is at the discression of the consumer, make sure you are only scraping profiles that you have permission to use.

Usage

Install the package

npm install --save linktree-scraper

Scrape a profile

const Scraper = require("linktree-scraper").default;

Scraper('username').then(profile => {
  console.log(profile);
}).catch((error) => {
  console.error(error);
  console.log('Uh oh!');
});

The results are somewhat normalized, but you can always the raw original values with profile.raw.

Here is an example of the raw data format that is returned.

If you are using typescript, we even export the typinging for the formatted profile results, so you can do:

import Scraper, { FormattedResults } from "../lib/index";

Scraper('username').then((profile: FormattedResults) => {
  console.log(profile);
}).catch((error: Error) => {
  console.error(error);
  console.log('Uh oh!');
});

Credits

I started this library off from this template: https://github.com/krasimir/webpack-library-starter

License

MIT

About

NPM library for scraping data from a linktree page

License:MIT License


Languages

Language:JavaScript 56.3%Language:TypeScript 43.7%