{"id":21385831,"url":"https://github.com/andreazllin/node-meta-parser","last_synced_at":"2026-04-30T07:43:05.898Z","repository":{"id":57746375,"uuid":"520961393","full_name":"andreazllin/node-meta-parser","owner":"andreazllin","description":"Get Open Graph and other metadata from a webpage","archived":false,"fork":false,"pushed_at":"2022-08-04T10:37:51.000Z","size":144,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-24T19:44:55.036Z","etag":null,"topics":["graph","html","meta","node","ogp","open","opengraph","parser","scraper","tags"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/node-meta-parser","language":"TypeScript","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/andreazllin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-08-03T16:49:42.000Z","updated_at":"2022-08-17T08:44:43.000Z","dependencies_parsed_at":"2022-08-25T18:10:20.538Z","dependency_job_id":null,"html_url":"https://github.com/andreazllin/node-meta-parser","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/andreazllin/node-meta-parser","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreazllin%2Fnode-meta-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreazllin%2Fnode-meta-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreazllin%2Fnode-meta-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreazllin%2Fnode-meta-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andreazllin","download_url":"https://codeload.github.com/andreazllin/node-meta-parser/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreazllin%2Fnode-meta-parser/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259518833,"owners_count":22870302,"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":["graph","html","meta","node","ogp","open","opengraph","parser","scraper","tags"],"created_at":"2024-11-22T11:51:19.215Z","updated_at":"2026-04-30T07:43:00.871Z","avatar_url":"https://github.com/andreazllin.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# node-meta-parser\n\nGet Open Graph and other metadata from a webpage!\n\n## Get started\n\nTo install the package:\n\n```bash\nnpm install --save node-meta-parser\n```\n\n## Methods\n\n### `parseMetadata`\n\nReturns the `\u003cmeta\u003e` tags from an HTML page in the following object format\n\n```json\n{\n  \"propertyName\": \"contentValue\"\n}\n```\n\n```typescript\nparseMetadata(rawHtml: string, properties: string[])\n```\n\n- **rawHtml**: is the *string* representing the HTML for the requested webpage.\n- **properties**: is an *array of strings* that are the property (or name) of a `\u003cmeta\u003e` tag\n\n```html\n\u003c!-- propertyName: \"og:title\" contentValue: \"Open Graph protocol\" --\u003e\n\u003cmeta property=\"og:title\" content=\"Open Graph protocol\"\u003e\n\n\u003c!-- propertyName: \"description\" contentValue: \"The Open Graph protocol enables any web page to become a rich object in a social graph.\" --\u003e\n\u003cmeta name=\"description\" content=\"The Open Graph protocol enables any web page to become a rich object in a social graph.\"\u003e\n```\n\n### `getFavicon`\n\nReturns the URL of the favicon\n\n```typescript\ngetFavicon(rawHtml: string)\n```\n\n- **rawHtml**: is the *string* representing the HTML for the requested webpage.\n\n## Example\n\nTo get the `\u003cmeta\u003e` tags values from a website you need to get a webpage's raw HTML first, you can use an HTTP client of your liking, the example uses [axios](https://www.npmjs.com/package/axios).\n\n```typescript\nimport axios from \"axios\"\nimport nmp from \"node-meta-parser\"\n\nvoid(async(): Promise\u003cvoid\u003e =\u003e {\n  const { data: rawHtml } = await axios.get(\"https://ogp.me/\")\n  const metadata = nmp.parseMetadata(rawHtml, [\"og:title\", \"og:type\", \"og:url\", \"og:image\", \"og:description\"])\n  console.log(metadata)\n})()\n```\n\nin this case `metadata` is like this:\n\n```json\n{\n  \"og:title\": \"Open Graph protocol\",\n  \"og:type\": \"website\",\n  \"og:url\": \"https://ogp.me/\",\n  \"og:image\": \"https://ogp.me/logo.png\",\n  \"og:description\": \"The Open Graph protocol enables any web page to become a rich object in a social graph.\"\n}\n```\n\n## Dependecies\n\n- [node-html-parser](https://www.npmjs.com/package/node-html-parser) - Fast HTML Parser.\n\n## Notes for myself\n\n### To use the latest build uploaded to GitHub\n\nTo add the package to the dependencies:\n\n```json\n{\n  \"dependencies\": {\n    \"node-meta-parser\": \"github:andreazllin/node-meta-parser#build\"\n  }\n}\n```\n\n### To push a new build\n\nGive execute permission to `update.sh` script:\n\n```bash\ncd scripts\nsudo chmod +x update.sh\n```\n\nExecute the script, it will transpile the branch `main` and push the folder `/dist/` to the build branch:\n\n```bash\nnpm run update\n```\n\n### Upload a new version to NPM\n\nTo upload a new version of the package:\n\n1. Change version in `package.json`.\n2. `npm run install` to update `package-lock.json` version.\n3. Commit and push changes to `main` branch.\n4. Checkout to `build` branch.\n5. `npm run update` to build and push latest version to GitHub.\n6. `npm publish` to publish a new version to NPM\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreazllin%2Fnode-meta-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandreazllin%2Fnode-meta-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreazllin%2Fnode-meta-parser/lists"}