{"id":15007962,"url":"https://github.com/bharat-1809/see-link","last_synced_at":"2025-07-11T00:05:20.804Z","repository":{"id":37008165,"uuid":"425453367","full_name":"bharat-1809/see-link","owner":"bharat-1809","description":"🔎 Get the preview metadata like title, description, image, video, etc from a link or a URL extracted from the given text.","archived":false,"fork":false,"pushed_at":"2022-06-19T13:47:35.000Z","size":238,"stargazers_count":16,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-29T03:27:15.678Z","etag":null,"topics":["javascript","link","link-preview","nodejs","npm-package","preview","puppeteer","url","url-preview"],"latest_commit_sha":null,"homepage":"https://seelink.bharatsharma.me","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bharat-1809.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-11-07T09:46:10.000Z","updated_at":"2023-12-03T10:41:19.000Z","dependencies_parsed_at":"2022-08-18T00:20:26.627Z","dependency_job_id":null,"html_url":"https://github.com/bharat-1809/see-link","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/bharat-1809/see-link","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bharat-1809%2Fsee-link","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bharat-1809%2Fsee-link/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bharat-1809%2Fsee-link/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bharat-1809%2Fsee-link/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bharat-1809","download_url":"https://codeload.github.com/bharat-1809/see-link/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bharat-1809%2Fsee-link/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264696189,"owners_count":23650934,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javascript","link","link-preview","nodejs","npm-package","preview","puppeteer","url","url-preview"],"created_at":"2024-09-24T19:14:39.576Z","updated_at":"2025-07-11T00:05:20.777Z","avatar_url":"https://github.com/bharat-1809.png","language":"JavaScript","funding_links":["https://www.paypal.me/bsharma1809"],"categories":[],"sub_categories":[],"readme":"\u003c!-- markdownlint-disable MD036 --\u003e\n# See-Link\n\n[![Build Status](https://img.shields.io/github/workflow/status/bharat-1809/see-link/CI?logo=github)](https://github.com/bharat-1809/see-link)\n[![Package Version](https://img.shields.io/badge/npm-v2.0.1-blue)](https://www.npmjs.com/package/see-link)\n[![License](https://img.shields.io/badge/License-MIT-orange)](https://github.com/bharat-1809/see-link/blob/2a79daaa549d986eb05d51c8a919452f84a3b14e/LICENSE)\n[![Donate](https://img.shields.io/badge/Donate-PayPal-00457C?logo=paypal)](https://www.paypal.me/bsharma1809)\n\n**See-a-Link**! Get the preview metadata like title, description, image, video, etc from a link or a link extracted from the given text.\n\nSee-Link looks through the [open-graph](http://ogp.me/), [twitter cards](https://developer.twitter.com/en/docs/tweets/optimize-with-cards/overview/markup) markup and other meta tags to get the preview information from the link. It visits a link in a headless browser and scrapes the required information. It can also return the dominant color of the page in case the `theme-color` is needed but no meta info is found.\n\n*To know more about **how See-Link works** checkout this [wiki](https://github.com/bharat-1809/see-link/wiki/How-does-see-link-works%3F).*\n\nCheck out [this article](https://dev.to/veerreshr/seo-tags-meta-tags-that-you-need-for-previews-on-social-networks-343n) to know about meta tags, SEO and their need for generating link previews.\n\n# Table of Contents\n\n- [Features](#features)\n- [Getting Started](#getting-started)\n- [Usage](#usage)\n- [API](#api)\n- [Options](#options)\n- [Test](#test)\n- [License](#license)\n\n## Features\n\n- Get the dominant color of the page if required.\n- Can return images present in html body incase meta tags are not available.\n- Can be customized to return the info as per the requirement.\n- Uses stealth measures and user-agent can be customized to bypass restrictions setup by sites to prevent bot scraping.\n\n**NOTE**\n\n- A different domain cannot be requested from your web app (browsers block cross-origin-requests). If you do not know how same-origin-policy works, here is a [great article](https://dev.to/lydiahallie/cs-visualized-cors-5b8h), therefore this library works on node (back-end environments) and certain mobile run-times (like react-native).\n\n- This library fetches the website and parses its html using [puppeteer](https://pptr.dev/), as if the user would visit the page. This means that some websites might redirect you to a sign-up page. You can try to change the user-agent property (by default it uses [Facebook's user agent](https://developers.facebook.com/docs/sharing/webmasters/crawler/#:~:text=app%20or%20website.-,Crawler%20IPs%20and%20User%20Agents,-The%20Facebook%20crawler)) and the response you get then might be different, but there is nothing wrong with this library.\n\n## Getting Started\n\n```bash\nnpm install see-link\n```\n\n## Usage\n\nIts quite simple:\n\n```javascript\nconst seeLink = require('see-link');\n\n(async () =\u003e {\n    const preview = await seeLink('https://www.bharatsharma.me');\n\n    // You can directly pass a url as above or pass a chunk of text\n    // and seeLink will extract the first link from it. Like this:\n\n    const preview_text = await seeLink('This text will be parsed by seeLink https://www.bharatsharma.me');\n\n    console.log(preview);\n})();\n```\n\nThe above code will result in the following output:\n\n```bash\n{\n  title: 'Bharat Sharma',\n  description: 'Personal website of Bharat Sharma',\n  image: 'https://bharatsharma.me/assets/images/logo.png',\n  domainName: 'bharatsharma.me'\n}\n```\n\n## API\n\n```javascript\nfunction seeLink(url: string, options?: seeLink.Options): Promise\u003cSeeLinkRes\u003e\n```\n\n`seeLink` takes a `url` and `options` object (*optional*). The `url` string can be **any link or a text containing a link**. It rejects with an error if there was no URL in the text provided.\n\n`seeLink` returns a promise that resolves to the preview metadata of the following type:\n\n```javascript\nSeeLinkRes {\n  title: string;\n  description: string;\n  image: string;\n  domainName: string;\n  video?: string;\n  themeColor?: string;\n  favIcon?: string;\n  type?: string;\n}\n```\n\n## Options\n\nAdditionally you can pass an options object to the function to change the default behaviour:\n\n| Option Name | Function  | Type |\n|-------------|-----------|------|\n| detailedPreview | Get all the possible metadata supported by the see-link (eg: video, theme-color, type, favIcon) | boolean |\n| getVideo | Get the video metadata along with the default result | boolean |\n| getThemeColor | Get the `theme-color` metadata along with the default result | boolean |\n| getDominantThemeColor | When `getThemeColor` is set to true and no `theme-color` meta info is found then get the dominant color of the page. By default it's `true` | boolean |\n| args | Arguments to pass to the `puppeteer.launch` function | string[] |\n| userAgent | User-Agent to use when visiting the website | string |\n| timeout | Timeout in milliseconds for the request | number |\n| executablePath | Path to the chrome/chromium executable | string |\n| headless | Whether to run the browser in headless mode | boolean |\n\n## Test\n\nThe library is tested using [Mocha](https://mochajs.org/) and [Chai](https://chaijs.com/). You can run the tests by running the following command in the project root:\n\n```bash\n./test.sh\n```\n\nIf `bash: ./test.sh: Permission denied` error is thrown, you can make the test executable by running the following command:\n\n```bash\nchmod +x test.sh\n```\n\nAlternatively, you can run the tests by running the following commands in the project root:\n\n```bash\nnpm run-script test-server\n```\n\nthen in another terminal run the following command:\n\n```bash\nnpm test\n```\n\n*NOTE:* The test server runs on port `3000` by default. You can change the port number in `test_setup/config.js` file.\n\n## License\n\nSee-Link is released under the [MIT License](https://github.com/bharat-1809/see-link/blob/2a79daaa549d986eb05d51c8a919452f84a3b14e/LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbharat-1809%2Fsee-link","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbharat-1809%2Fsee-link","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbharat-1809%2Fsee-link/lists"}