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

medium-scrape

v0.0.2

Published

Scraper for Medium.com posts

Downloads

62

Readme

Medium Scraper

A simple medium.com post scraper using Axios, and Cheerio.

Install

npm i --save medium-scrape

Usage

Script:

const medium = require('medium-scrape');
const link = 'https://medium.com/@nickgrego/step-by-step-guide-for-installing-both-ecdsa-beacon-nodes-on-vps-with-100-voucher-db930ab2a667';


(async() => {
    try {
        let post = await medium.get(link);
        console.log(post);
    } catch (e) {
        console.error(e);
    }
})();

Output:

{
  title: 'Step-by-step guide for installing both ECDSA & Beacon Keep Network nodes on VPS with 100$ voucher.',
  body: [
    '<p><em>*08/09/2020 all configurations and commands are updated for installing the latest release</em></p>',
    '<p>This is step by step tutorial for newcomers to launch their first nodes in Keep Network with completely free VPS server and with minimal use of command line. To avoid any sort of errors, we would use the most user-friendly instruments to successfully complete this task fast and without any kind of mistakes.</p>',
    '<p>First, we need <a href="https://www.google.com/chrome/" rel="noopener nofollow">Google Chrome</a> with the <a href="https://chrome.google.com/webstore/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn" rel="noopener nofollow">MetaMask</a> extension installed.</p>',
    '<p><strong>Step 1. Creating a server</strong></p>',
    ...
  ]
}

You can also append attribute class, id, width, height, etc. to the tag

Script:

const medium = require('medium-scrape');
const link = 'https://medium.com/@nickgrego/step-by-step-guide-for-installing-both-ecdsa-beacon-nodes-on-vps-with-100-voucher-db930ab2a667';


(async() => {
    try {
        let post = await medium.get(link, {
            p: {
                class: 'awsome class',
            },
            img: {
                height: '700',
                width: '400',
            },
            pre: {
                id: 'post-id',
            },
        });
        console.log(post);
    } catch (e) {
        console.error(e);
    }
})();

Output:

{
  title: 'Step-by-step guide for installing both ECDSA & Beacon Keep Network nodes on VPS with 100$ voucher.',
  body: [
    '<p class="awsome class"><em>*08/09/2020 all configurations and commands are updated for installing the latest release</em></p>',
    '<p class="awsome class">This is step by step tutorial for newcomers to launch their first nodes in Keep Network with completely free VPS server and with minimal use of command line. To avoid any sort of errors, we would use the most user-friendly instruments to successfully complete this task fast and without any kind of mistakes.</p>',
    ...

    '<figure><img width="400" height="700" alt="Image for post" src="https://miro.medium.com/max/2508/1*kIejFeeea87rafK2x2ao9Q.gif" srcSet="https://miro.medium.com/max/552/1*kIejFeeea87rafK2x2ao9Q.gif 276w, https://miro.medium.com/max/1104/1*kIejFeeea87rafK2x2ao9Q.gif 552w, https://miro.medium.com/max/1280/1*kIejFeeea87rafK2x2ao9Q.gif 640w, https://miro.medium.com/max/1400/1*kIejFeeea87rafK2x2ao9Q.gif 700w"/></figure>',
    ...

    '<pre id="post-id"><span>cd<br>cd ecdsa<br>export KEEP_ECDSA_OPERATOR_ACCOUNT_PASSWORD=$(cat ./config/keep-ecdsa-operator-account-password.txt)</span><span>sudo docker run -d \\<br>--entrypoint keep-ecdsa \\<br>--restart always \\<br>--volume /root/ecdsa/persistence:/mnt/keep-ecdsa-client/persistence \\<br>--volume /root/ecdsa/config:/mnt/keep-ecdsa-client/config \\<br>--env KEEP_ETHEREUM_PASSWORD=$KEEP_ECDSA_OPERATOR_ACCOUNT_PASSWORD \\<br>--env LOG_LEVEL=debug \\<br>--name ecdsa-node \\<br>-p 3919:3919 \\<br>keepnetwork/keep-ecdsa-client:v1.2.0-rc.5 --config /mnt/keep-ecdsa-client/config/config.toml start</span></pre>',
    ...
  ]
}

Markdown

input

const medium = require('medium-scrape');
const link = 'https://medium.com/@freidlion/%D0%B5%D0%BA%D0%BE%D0%BD%D0%BE%D0%BC%D1%96%D0%BA%D0%B0-%D1%81%D1%82%D0%B5%D0%B9%D0%BA%D1%96%D0%BD%D0%B3%D0%B0-76b7d9459686';


(async() => {
    try {
        let post = await medium.md(link);
        console.log(post);
    } catch (e) {
        console.error(e);
    }
})();

output

{
  title: 'tBTC тепер з повністю відкритим кодом',
  body: 'tBTC тепер з повністю відкритим кодом\n' +
    '\n' +
    '[Keep ECDSA](https://github.com/keep-network/keep-ecdsa), який лежить в основі груп підписувачів, тепер доступний у GitHub. Сюди входять фрагменти, що зберігаються і виключаються з ланцюга ECDSA, а також зберігається в обліковій системі ECDSA для мережі Keep, яка дозволяє створювати та функціонувати групи підписувачів на tBTC.\n' +
    '\n' +
    'tBTC прагне відкритих джерел інформації як найкращого стандарту для прозорості та безпеки DeFi. Цей відкритий канал робить tBTC першим і єдиним мостом BTC, який дозволяє підписувати без дозволу.\n' +
    '\n' +
    '[Приєднуйтесь до списку розсилки tBTC](https://tbtc.network/#mailing-list), щоб отримати оновлення, включаючи інформацію про майбутній запуск tBTC у мережі Ethereum.\n' +
    '\n' +
    'Додаткові ресурси:\n' +
    '\n' +
    '*   [GitHub](https://github.com/keep-network/tbtc)\n' +
    '*   [Технічні специфікації](https://docs.keep.network/tbtc/index.pdf)\n' +
    '*   [tbtc.js](https://tbtc.network/news/2020-02-14-announcing-tbtc-js)\n' +
    '*   [Keep #tbtc канал у Discord](https://chat.tbtc.network/)\n' +
    '\n' +
    'Слідкуйте за [#tBTC у Twitter](https://twitter.com/hashtag/tBTC), щоб дізнатись про новини та можливості для участі.'
}