{"_id":"@xyne/unfurl","_rev":"6-a81ef8045ab7df64f2134a8bc9cfc2be","name":"@xyne/unfurl","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@xyne/unfurl","version":"0.1.0","keywords":["oembed","twitter-cards","open-graph-protocol","open-graph","ogp","scraper","scraping","embedding","embed","iframe","metadata","node.js","fast"],"author":{"name":"Jack Tuck"},"license":"ISC","_id":"@xyne/unfurl@0.1.0","maintainers":[{"name":"sahebjot","email":"saheb@xynehq.com"}],"contributors":[{"name":"Sahebjot Singh"}],"homepage":"https://github.com/xynehq/unfurl#readme","bugs":{"url":"https://github.com/xynehq/unfurl/issues"},"dist":{"shasum":"4097de1e5120c4cee4c342a7b3e5126e3f32184d","tarball":"https://registry.npmjs.org/@xyne/unfurl/-/unfurl-0.1.0.tgz","fileCount":69,"integrity":"sha512-/JlyYQ8mZoEfA444vrnRotnicLhQqyqzVPoL8mMNBZO7nNk4kiWXk765EKT4X+E26QWzINDhhPlZk76UKpiMOA==","signatures":[{"sig":"MEQCICbSYi6iZTfYLfDEWsC+GHtr/Loct1ksWCPUNhkNtXicAiBaIq+YkaaLqYYXcLWMDpxtBjqqDR73Ezk1LQBe6TXXOw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":132922},"main":"dist/index.js","types":"./dist/index.d.ts","gitHead":"c5cceb234511d97ee3558378adc079bebaf8b0ed","scripts":{"lint":"eslint . --ext .ts","test":"npm run lint && port=9000 jest --verbose --runInBand --coverage --coveragePathIgnorePatterns '/test/'","build":"tsc --outDir dist","start":"node dist/index.js","watch":"tsc -w --outDir dist","travis":"port=9000 jest --verbose --runInBand --coverage --coverageReporters=text-lcov --coveragePathIgnorePatterns '/test/' | coveralls","prepare":"npm run build"},"_npmUser":{"name":"sahebjot","email":"saheb@xynehq.com"},"repository":{"url":"git://github.com/xynehq/unfurl.git","type":"git"},"_npmVersion":"10.2.4","description":"Scraper for oEmbed, Twitter Cards and Open Graph metadata - fast and Promise-based","directories":{},"_nodeVersion":"20.11.0","dependencies":{"he":"^1.2.0","debug":"^3.2.7","htmlparser2":"^8.0.1"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","nock":"^13.1.3","eslint":"^8.26.0","ts-jest":"^23.1.4","prettier":"^2.7.1","coveralls":"^3.0.2","typescript":"^4.8.4","@types/jest":"^23.3.2","semantic-release":"^23.0.2","@types/htmlparser2":"^3.10.3","eslint-config-prettier":"^8.5.0","eslint-plugin-prettier":"^4.2.1","@typescript-eslint/parser":"^5.40.1","eslint-plugin-unused-imports":"^2.0.0","@typescript-eslint/eslint-plugin":"^5.40.1"},"_npmOperationalInternal":{"tmp":"tmp/unfurl_0.1.0_1707595050368_0.15903720607324856","host":"s3://npm-registry-packages"}}},"time":{"created":"2024-02-10T19:57:30.250Z","modified":"2026-06-25T09:15:16.699Z","0.1.0":"2024-02-10T19:57:30.520Z"},"bugs":{"url":"https://github.com/xynehq/unfurl/issues"},"author":{"name":"Jack Tuck"},"license":"ISC","homepage":"https://github.com/xynehq/unfurl#readme","keywords":["oembed","twitter-cards","open-graph-protocol","open-graph","ogp","scraper","scraping","embedding","embed","iframe","metadata","node.js","fast"],"repository":{"url":"git://github.com/xynehq/unfurl.git","type":"git"},"description":"Scraper for oEmbed, Twitter Cards and Open Graph metadata - fast and Promise-based","contributors":[{"name":"Sahebjot Singh"}],"maintainers":[{"email":"saheb@xynehq.com","name":"sahebjot"},{"email":"kalp.a@juspay.in","name":"kalpadhwaryu"},{"email":"shailendra.pratap@juspay.in","name":"shailendra_pratap_03"},{"email":"arshith.balaraju@juspay.in","name":"arshith_varma"},{"email":"junaid.s@xynehq.com","name":"junaid_shirur"},{"email":"utkarsh.pandey@juspay.in","name":"utkarsh.pandey"}],"readme":"# Unfurl\nThis project is a fork of [Unfurl.js](https://github.com/jacktuck/unfurl).\nWe wanted a way to run this in the browser, we do not face CORS issues as we are running it in the service worker of chrome extension.\n\n## The what\nUnfurl _(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.\n\n## The why\nSo you know when you link to something on Slack, or Facebook, or Twitter - they typically show a preview of the link. To do so they have crawled the linked website for metadata and enriched the link by providing more context about it. Which usually entails grabbing its title, description and image/player embed.\n\n## The how\n```bash\nnpm install @xyne/unfurl\n```\n\n### `unfurl(url [, opts])`\n#### url - `string`\n---\n#### opts - `object` of:\n-  `oembed?: boolean` - support retrieving oembed metadata\n-  `timeout?  number` - req/res timeout in ms, it resets on redirect. 10000 default\n-  `follow?: number` - maximum redirect count. 0 to not follow redirect\n-  `compress?: boolean` - support gzip/deflate content encoding\n-  `size?: number` - maximum response body size in bytes. 0 to disable\n-  `headers?: Headers | Record<string, string> | Iterable<readonly [string, string]> | Iterable<Iterable<string>>` - map of request headers, overrides the defaults\n\nDefault headers:\n```\n{\n  'Accept': 'text/html, application/xhtml+xml',\n  'User-Agent': 'facebookexternalhit'\n}\n```\n---\n#\n```typescript\nimport { unfurl } from '@xyne/unfurl'\nconst result = unfurl('https://github.com/trending')\n```\n---\n#### result is `<Promise<Metadata>>`\n```typescript\ntype Metadata = {\n  title?: string\n  description?: string\n  keywords?: string[]\n  favicon?: string\n  author?: string\n  theme_color?: string\n  canonical_url?: string\n  oEmbed?: {\n    type: 'photo' | 'video' | 'link' | 'rich'\n    version?: string\n    title?: string\n    author_name?: string\n    author_url?: string\n    provider_name?: string\n    provider_url?: string\n    cache_age?: number\n    thumbnails?: [{\n      url?: string\n      width?: number\n      height?: number\n    }]\n  }\n  twitter_card: {\n    card: string\n    site?: string\n    creator?: string\n    creator_id?: string\n    title?: string\n    description?: string\n    players?: {\n      url: string\n      stream?: string\n      height?: number\n      width?: number\n    }[]\n    apps: {\n      iphone: {\n        id: string\n        name: string\n        url: string\n      }\n      ipad: {\n        id: string\n        name: string\n        url: string\n      }\n      googleplay: {\n        id: string\n        name: string\n        url: string\n      }\n    }\n    images: {\n      url: string\n      alt: string\n    }[]\n  }\n  open_graph: {\n    title: string\n    type: string\n    images?: {\n      url: string\n      secure_url?: string\n      type: string\n      width: number\n      height: number\n      alt?: string\n    }[]\n    url?: string\n    audio?: {\n      url: string\n      secure_url?: string\n      type: string\n    }[]\n    description?: string\n    determiner?: string\n    site_name?: string\n    locale: string\n    locale_alt: string\n    videos: {\n      url: string\n      stream?: string\n      height?: number\n      width?: number\n      tags?: string[]\n    }[]\n    article: {\n      published_time?: string\n      modified_time?: string\n      expiration_time?: string\n      author?: string\n      section?: string\n      tags?: string[]\n    }\n  }\n}\n```\n","readmeFilename":"README.md"}