Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Brian/pull upstream #13

Merged
merged 14 commits into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading