Skip to content
Link extractor from Steem App
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
.gitignore
.travis.yml
Changelog.md
Contributing.md
LICENSE.txt
README.md
jest.config.js
package-lock.json
package.json
rollup.config.ts
tsconfig.json

README.md

steem-link-extractor

npm version Build Status License: MIT

A simple tools to extract links and generate links for different steem platform.

About Steem Link Extractor

In Steem blockchain, there is so many apps that used different kind of pathname to keep track of profile and post. This project aims to unite them all.

Technology Stack:

  • TypeScript
  • Jest
  • Rollup

Housekeeping

Installation

$ npm i --save steem-link-extractor
$ yarn add steem-link-extractor

Requirement

  • URL API required.
  • Node 10+ (support new URL, refer to this)
  • not IE 11 (Refer to URL)

Polyfill required to support this library.

Usage

You can checkout example at index.js and index.mjs

Import

ES5 import / TS Import

import {
  extractPostLink,
  generateProfileLink,
  generatePostLink
} from "steem-link-extractor";

CommonJS

const {
  extractPostLink,
  generateProfileLink,
  generatePostLink
} = require("steem-link-extractor");

API

// extractPostLink

// Extract with predefined link.json
console.log(
  extractPostLink(
    "https://steemit.com/cloud/@superoo7/side-to-side-comparison-of-digital-ocean-and-aws-lightsail"
  )
);
/** Output
 * {
 *   name: 'steemit',
 *   author: 'superoo7',
 *   permlink: 'side-to-side-comparison-of-digital-ocean-and-aws-lightsail',
 *   category: 'cloud'
 * }
 */

// Extract without predefined link.json (Assuming it is not yet being add into link.json)
// Currently presuming the site pathname is following format: `anything/anything/@{{author}}/{{permlink}}`
// author startsWith "@" and followed by permlink
console.log(
  extractPostLink(
    "https://steemit.com/cloud/@superoo7/side-to-side-comparison-of-digital-ocean-and-aws-lightsail",
    { automatic: true }
  )
);

// generateProfileLink

console.log(generateProfileLink("musing", "superoo7"));
/** Output
 * https://musing.io/profile/superoo7
 */

// generatePostLink

console.log(
  generatePostLink(
    "steemhunt",
    "superoo7",
    "tailwind-css-utility-first-css-framework"
  )
);
/** Output
 * https://steemhunt.com/@superoo7/tailwind-css-utility-first-css-framework
 */

// if you have category
console.log(
  generatePostLink(
    "steemit",
    "superoo7",
    "side-to-side-comparison-of-digital-ocean-and-aws-lightsail",
    "cloud"
  )
);
/** Output
 * https://steemit.com/cloud/@superoo7/side-to-side-comparison-of-digital-ocean-and-aws-lightsail
 */

LICENSE

MIT

You can’t perform that action at this time.