Skip to content

Commit

Permalink
Merge pull request #13 from HereNotThere/brian/pull_upstream
Browse files Browse the repository at this point in the history
Brian/pull upstream
  • Loading branch information
brianathere authored Apr 9, 2024
2 parents 165d188 + f31f375 commit 23da949
Show file tree
Hide file tree
Showing 18 changed files with 18,596 additions and 8,169 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
fetch-depth: 0
- uses: actions/setup-node@v1
with:
node-version: 17
node-version: 18
- run: npm ci
- name: release
env:
Expand Down
70 changes: 51 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ yarn add unfurl.js@<git-remote-url>

# Unfurl

A metadata scraper with support for oEmbed, Twitter Cards and Open Graph Protocol for Node.js (>=v8.0.0)
A metadata scraper with support for oEmbed, Twitter Cards and Open Graph Protocol for Node.js (>=v8.0.0).

Note: Will not work in the Browser

[![Travis CI](https://img.shields.io/travis/jacktuck/unfurl?style=flat-square)](https://travis-ci.org/jacktuck/unfurl)
[![Coverage Status](https://img.shields.io/coveralls/jacktuck/unfurl?style=flat-square)](https://coveralls.io/github/jacktuck/unfurl?branch=master)
Expand All @@ -29,7 +31,7 @@ A metadata scraper with support for oEmbed, Twitter Cards and Open Graph Protoco

## The what

Unfurl _(spread out from a furled state)_ will take a `url` and some `options`, fetch the `url`, extract the metadata we care about and format the result in a saine way. It supports all major metadata providers and expanding it to work for any others should be trivial.
Unfurl _(spread out from a furled state)_ will take a `url` and some `options`, fetch the `url`, extract the metadata we care about and format the result in a sane way. It supports all major metadata providers and expanding it to work for any others should be trivial.

## The why

Expand Down Expand Up @@ -85,23 +87,9 @@ type Metadata = {
keywords?: string[];
favicon?: string;
author?: string;
oEmbed?: {
type: "photo" | "video" | "link" | "rich";
version?: string;
title?: string;
author_name?: string;
author_url?: string;
provider_name?: string;
provider_url?: string;
cache_age?: number;
thumbnails?: [
{
url?: string;
width?: number;
height?: number;
}
];
};
theme_color?: string;
canonical_url?: string;
oEmbed?: OEmbedPhoto | OEmbedVideo | OEmbedLink | OEmbedRich;
twitter_card: {
card: string;
site?: string;
Expand Down Expand Up @@ -146,6 +134,7 @@ type Metadata = {
type: string;
width: number;
height: number;
alt?: string;
}[];
url?: string;
audio?: {
Expand Down Expand Up @@ -175,6 +164,49 @@ type Metadata = {
};
};
};

type OEmbedBase = {
type: "photo" | "video" | "link" | "rich";
version: string;
title?: string;
author_name?: string;
author_url?: string;
provider_name?: string;
provider_url?: string;
cache_age?: number;
thumbnails?: [
{
url?: string;
width?: number;
height?: number;
}
];
};

type OEmbedPhoto = OEmbedBase & {
type: "photo";
url: string;
width: number;
height: number;
};

type OEmbedVideo = OEmbedBase & {
type: "video";
html: string;
width: number;
height: number;
};

type OEmbedLink = OEmbedBase & {
type: "link";
};

type OEmbedRich = OEmbedBase & {
type: "rich";
html: string;
width: number;
height: number;
};
```

## The who 💖
Expand Down
24 changes: 19 additions & 5 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions dist/schema.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 23da949

Please sign in to comment.