{"id":29194755,"url":"https://github.com/paradite/url-to-json-markdown","last_synced_at":"2026-04-02T01:34:03.791Z","repository":{"id":301878898,"uuid":"1008066138","full_name":"paradite/url-to-json-markdown","owner":"paradite","description":"A TypeScript library that fetches URLs and converts them to structured JSON and Markdown format.","archived":false,"fork":false,"pushed_at":"2025-07-14T08:05:04.000Z","size":129,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-15T13:14:13.908Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/paradite.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-25T01:22:16.000Z","updated_at":"2025-07-14T08:05:07.000Z","dependencies_parsed_at":"2025-06-29T11:43:06.452Z","dependency_job_id":null,"html_url":"https://github.com/paradite/url-to-json-markdown","commit_stats":null,"previous_names":["paradite/url-to-json-markdown"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/paradite/url-to-json-markdown","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paradite%2Furl-to-json-markdown","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paradite%2Furl-to-json-markdown/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paradite%2Furl-to-json-markdown/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paradite%2Furl-to-json-markdown/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/paradite","download_url":"https://codeload.github.com/paradite/url-to-json-markdown/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paradite%2Furl-to-json-markdown/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31293938,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-02T01:05:07.454Z","status":"ssl_error","status_checked_at":"2026-04-02T00:56:46.496Z","response_time":53,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2025-07-02T04:38:03.432Z","updated_at":"2026-04-02T01:34:03.772Z","avatar_url":"https://github.com/paradite.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# url-to-json-markdown\n\n[![NPM version](https://img.shields.io/npm/v/url-to-json-markdown)](https://www.npmjs.com/package/url-to-json-markdown)\n\nA TypeScript library that fetches URLs and converts them to structured JSON and Markdown format.\n\nBuilt by [16x Writer](https://writer.16x.engineer/) and [16x Eval](https://eval.16x.engineer/) team.\n\n## Installation\n\n```bash\nnpm install url-to-json-markdown\n```\n\n## Usage\n\n```typescript\nimport { urlToJsonMarkdown } from 'url-to-json-markdown';\n\n// Reddit post (using fallback without credentials)\nconst post = await urlToJsonMarkdown(\n  'https://www.reddit.com/r/example/comments/12345/title/'\n);\nconsole.log(post.title); // \"Post Title\"\nconsole.log(post.content); // \"# Post Title\\n\\nPost content...\\n\\nby _username_ (↑ 123) 12/25/2024\"\nconsole.log(post.type); // \"reddit\"\n\n// Reddit post with credentials (more reliable)\nconst postWithCreds = await urlToJsonMarkdown(\n  'https://www.reddit.com/r/example/comments/12345/title/',\n  {\n    clientId: 'your_client_id',\n    clientSecret: 'your_client_secret',\n  }\n);\n\n// Reddit post with comments included\nconst postWithComments = await urlToJsonMarkdown(\n  'https://www.reddit.com/r/example/comments/12345/title/',\n  {\n    clientId: 'your_client_id',\n    clientSecret: 'your_client_secret',\n    includeComments: true,\n  }\n);\n// Will include \"## Comments\" section with tree-structured comments\n\n// Reddit comment\nconst comment = await urlToJsonMarkdown(\n  'https://www.reddit.com/r/example/comments/12345/comment/abc123/'\n);\nconsole.log(comment.title); // \"First line of comment...\"\nconsole.log(comment.content); // \"# Comment by username\\n\\nComment text...\\n\\nby _username_ (↑ 45)\"\nconsole.log(comment.type); // \"reddit\"\n\n// Reddit comment with child comments/replies\nconst commentWithReplies = await urlToJsonMarkdown(\n  'https://www.reddit.com/r/example/comments/12345/comment/abc123/',\n  { includeComments: true }\n);\n// Will include \"## Replies\" section with tree-structured child comments\n\n// Generic web page\nconst webpage = await urlToJsonMarkdown('https://example.com/article');\nconsole.log(webpage.title); // \"Article Title\"\nconsole.log(webpage.content); // \"# Article Title\\n\\nMain content as markdown...\"\nconsole.log(webpage.type); // \"generic\"\n```\n\n## API\n\n### `urlToJsonMarkdown(url: string, options?: RedditOptions): Promise\u003cUrlToJsonResult\u003e`\n\n**Parameters:**\n\n- `url` - The URL to fetch and convert\n- `options` - Optional Reddit configuration\n\n**Reddit Options:**\n\n```typescript\ninterface RedditOptions {\n  clientId?: string;\n  clientSecret?: string;\n  includeComments?: boolean;\n}\n```\n\n- `clientId` \u0026 `clientSecret` - Reddit API credentials for more reliable access\n- `includeComments` - Include comments in a tree structure (Reddit posts) or child comments/replies (Reddit comments)\n\n**Return Type:**\n\n```typescript\ninterface UrlToJsonResult {\n  title: string;\n  content: string;\n  type: 'reddit' | 'generic';\n}\n```\n\n## Reddit Access\n\nFor Reddit URLs, the library supports two modes:\n\n1. **Fallback mode (no credentials)**: Uses browser user agent to access Reddit's public JSON API. May be subject to rate limiting.\n\n2. **Authenticated mode (with credentials)**: Uses Reddit OAuth API for more reliable access. Requires Reddit app credentials.\n\nTo get Reddit credentials:\n\n1. Go to https://www.reddit.com/prefs/apps\n2. Create a new app (script type)\n3. Use the client ID and secret\n\n## Supported URLs\n\n- **Reddit**: Posts and comments from reddit.com\n- **Generic**: Any website with automatic content extraction\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparadite%2Furl-to-json-markdown","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fparadite%2Furl-to-json-markdown","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparadite%2Furl-to-json-markdown/lists"}