{"id":23143469,"url":"https://github.com/sh20raj/webscrapperjs","last_synced_at":"2025-08-17T14:33:30.319Z","repository":{"id":230361983,"uuid":"451831456","full_name":"SH20RAJ/WebScrapperJS","owner":"SH20RAJ","description":"WebScrapperJS - Get Content/HTML of any website without being blocked by CORS even using JavaScript by WhollyAPI ","archived":false,"fork":false,"pushed_at":"2024-04-09T12:10:07.000Z","size":115,"stargazers_count":10,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-09T19:03:08.640Z","etag":null,"topics":["api","javascript","javascript-library","sh20raj","webscraping","websitescraping","whollyapi"],"latest_commit_sha":null,"homepage":"https://sh20raj.github.io/WebScrapperJS/","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/SH20RAJ.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,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2022-01-25T10:26:05.000Z","updated_at":"2025-04-09T18:08:15.000Z","dependencies_parsed_at":"2024-04-09T13:33:05.309Z","dependency_job_id":"613782c3-e568-451d-af55-68a75a515c0c","html_url":"https://github.com/SH20RAJ/WebScrapperJS","commit_stats":null,"previous_names":["sh20raj/webscrapperjs"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/SH20RAJ/WebScrapperJS","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SH20RAJ%2FWebScrapperJS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SH20RAJ%2FWebScrapperJS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SH20RAJ%2FWebScrapperJS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SH20RAJ%2FWebScrapperJS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SH20RAJ","download_url":"https://codeload.github.com/SH20RAJ/WebScrapperJS/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SH20RAJ%2FWebScrapperJS/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270859446,"owners_count":24658206,"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","status":"online","status_checked_at":"2025-08-17T02:00:09.016Z","response_time":129,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["api","javascript","javascript-library","sh20raj","webscraping","websitescraping","whollyapi"],"created_at":"2024-12-17T15:13:31.189Z","updated_at":"2025-08-17T14:33:30.040Z","avatar_url":"https://github.com/SH20RAJ.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# WebScrapperJS [![](https://data.jsdelivr.com/v1/package/gh/SH20RAJ/WebScrapperJS/badge)](https://www.jsdelivr.com/package/gh/SH20RAJ/WebScrapperJS) [![Visitors](https://api.visitorbadge.io/api/visitors?path=https%3A%2F%2Fgithub.com%2FSH20RAJ%2FWebScrapperJS%2F\u0026labelColor=%23ff8a65\u0026countColor=%232ccce4)](https://visitorbadge.io/status?path=https%3A%2F%2Fgithub.com%2FSH20RAJ%2FWebScrapperJS%2F)\nWebScrapperJS - Get Content/HTML of any website without being blocked by CORS even using JavaScript by WhollyAPI \n\n---\n\u003ccenter\u003e\nWebsite :- \u003ca href=\"https://sh20raj.github.io/WebScrapperJS/\"\u003e https://sh20raj.github.io/WebScrapperJS/ \u003c/a\u003e \n\n---\n\u003ca href=\"https://github.com/SH20RAJ/WebScrapperJS/\"\u003eGitHub\u003c/a\u003e  | \u003ca href=\"https://replit.com/@SH20RAJ/WebScrapperJS/\"\u003eRepl.it\u003c/a\u003e | \u003ca href=\"https://dev.to/sh20raj/webscrapperjs-get-contenthtml-of-any-website-without-being-blocked-by-cors-even-using-javascript-by-whollyapi-42l7\"\u003eDev.to Article\u003c/a\u003e\n\n\u003c/center\u003e\n\n---\n\n## Grab the CDN or Download the JavaScript File\n\n```html\n\u003cscript src=\"https://cdn.jsdelivr.net/gh/SH20RAJ/WebScrapperJS/WebScrapper.js\" \u003e\u003c/script\u003e\n```\n---\n\n- **`WebScrapper.get()`** will return you the content of the provided url in a String. \n\n- **`WebScrapper.gethtml()`** will return you the content of the provided url as Parsed DOM. ( Will get the html and Parse it as a DOM object . Will return you a #Document)\n\n- **`WebScrapper.getjson()`** will return you the content of the provided url as Parsed JSON.\n\n---\n\n### To Get HTML/Text/Content of Any Website in a String.\n\n```javascript\nvar html = WebScrapper.get('https://webscrapperjs.sh20raj.repl.co/');//This will be return the HTML/Text inside the webpage in a String.\nconsole.log(html);\n```\nThis will be return the HTML/Text inside the webpage in a String.\n\n\u003ca href=\"https://jsfiddle.net/sh20raj/sbxjfv0c/\"\u003eTry this\u003c/a\u003e\n\n---\n\n\n### To Get HTML Content of Any Website in DOM Parsed Form `WebScrapper.gethtml()` \n```javascript\nvar url = 'https://google.com/';\nvar html = WebScrapper.gethtml(url);//html of the url will be Parsed and stored in this variable\nconsole.log(html);\nconsole.log(html.title);//As you Use document.title you can Use Like this to get the title.\n```\n\n---\n\n### Intialise own WebScrapper with URL `new scrapper()`\n```javascript\nlet MyWebScrapper = new scrapper('https://example.com/');\n//You can now directly call gethtml() instead of passing a url into it.\n\nconsole.log(MyWebScrapper.gethtml()); //Grab https://example.com/ and print on console\n\n```\n\nStill you can Use new created scrapper `MyWebScrapper` for grabbing new URLs. Like\n\n```javascript\nlet MyWebScrapper = new scrapper('https://example.com/');\n//You can now directly call gethtml() instead of passing a url into it.\n\nconsole.log(MyWebScrapper.gethtml()); //Grab https://example.com/ and print on console\n\nconsole.log(MyWebScrapper.gethtml('https://example.com/')); //Grab https://youtube.com/ and print on console\n\n```\n\n---\n### You can also fetch JSON Using WebScrapperJS \n```javascript\nvar json = WebScrapper.getjson('https://jsonplaceholder.typicode.com/todos/1');//Return result direct in json format\nconsole.log(json);\n```\n\u003ca href=\"https://jsfiddle.net/sh20raj/voty4xpr/\"\u003eTry This\u003c/a\u003e\n\n---\n## Getting Result more Faster\n\n**Use the Below codes/methods only if the origin or feching URL is not blocked by CORS Like this**\n\n![cors preview](cors.PNG)\n\nif your origin is not blocking you then you must use the below fetch() code instead of gethtml() directly.\nbecause it returns the results faster without using API.It will directly fetch origin using AJAX.\n\n### Use `WebScrapper.fetch()`  to get the html/text in a string\n\nWe will use this url `https://webscrapperjs.sh20raj.repl.co/` because it is not blocked.\n\n```javascript\nvar html = WebScrapper.fetch('https://webscrapperjs.sh20raj.repl.co/');//This will be return the HTML/Text inside the webpage a string.\nconsole.log(html);\n```\nThis will be return the HTML/Text inside the webpage in a String.\n\n\u003ca href=\"https://jsfiddle.net/sh20raj/sbxjfv0c/\"\u003eTry this\u003c/a\u003e\n\n---\n\n### Use `WebScrapper.fetchhtml()`  to get the Parsed HTML/DOM document as `WebScrapper.gethtml()`.\n\n```javascript\nvar html = WebScrapper.fetchhtml('https://webscrapperjs.sh20raj.repl.co/');//This will be return the Parsed HTML inside the webpage. \nconsole.log(html);\nconsole.log(html.title);\n```\n\u003ca href=\"https://jsfiddle.net/sh20raj/8fc2u1nj/\"\u003eTry this\u003c/a\u003e\n\n---\n\n### Use `WebScrapper.fetchjson()`  to get the Parsed JSON\n\n```javascript\nvar json = WebScrapper.fetchjson('https://webscrapperjs.sh20raj.repl.co/sample.json');//This will be return the JSON inside the webpage. \nconsole.log(json);\nconsole.log(json.id);\n```\n\u003ca href=\"https://jsfiddle.net/sh20raj/okuLswtg/\"\u003eTry this\u003c/a\u003e\n\n---\n\n### Try this on Codepen\n\nSample Code | Codepen :- \u003ca href=\"https://codepen.io/SH20RAJ/pen/VwrwjXJ?editors=1001\"\u003ehttps://codepen.io/SH20RAJ/pen/VwrwjXJ?editors=1001\u003c/a\u003e\n\n```html\n\u003cdiv id=\"scrappedcontent\"\u003e\u003c/div\u003e\n\n\u003cscript src=\"https://cdn.jsdelivr.net/gh/SH20RAJ/WebScrapperJS/WebScrapper.min.js\" \u003e\u003c/script\u003e \n\u003cscript\u003e\n  let MyWebScrapper = new scrapper('https://google.com/');\n//You can now directly call gethtml() instead of passing a url into it.\n\nconsole.log(MyWebScrapper.gethtml()); //Grab https://example.com/ and print on console\nvar html = MyWebScrapper.gethtml('https://example.com/');\n  \nconsole.log(html); //Grab https://youtube.com/ and print on console\n  \ndocument.getElementById('scrappedcontent').innerHTML = html;\n\u003c/script\u003e\n```\n\nSee Results \u003ca href=\"https://codepen.io/SH20RAJ/pen/VwrwjXJ?editors=1001\"\u003eHere\u003c/a\u003e \n\n---\n\n# Other Features\n\n## `WebScrapper.getparam()` get URL Parameters\n\nAssuming your Current URL is `https://example.com/?id=7`.\n```javascript\nlet id = WebScrapper.getparam('id');\nconsole.log(id);//Will Return \"7\" .\n\n```\n\n### Use Custom string instead of current URL\n\n```javascript\nlet id = WebScrapper.getparam('id','https://example.com/?id=20');\nconsole.log(id);//Will Return \"20\" .\n\n```\n\n## `WebScrapper.getRandomInt()` get random integer in range\n\nThis function take 2 parameter `WebScrapper.getRandomInt(min,max)` the generated number will be in between min and max.\n```javascript\nlet id = WebScrapper.getRandomInt(10,100);\nconsole.log(id);//Will Return a number between 10 and 100 .\n\n```\n\n\n## Star History\n\n\u003ca href=\"https://star-history.com/#sh20raj/webscrapperjs\u0026Date\"\u003e\n \u003cpicture\u003e\n   \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"https://api.star-history.com/svg?repos=sh20raj/webscrapperjs\u0026type=Date\u0026theme=dark\" /\u003e\n   \u003csource media=\"(prefers-color-scheme: light)\" srcset=\"https://api.star-history.com/svg?repos=sh20raj/webscrapperjs\u0026type=Date\" /\u003e\n   \u003cimg alt=\"Star History Chart\" src=\"https://api.star-history.com/svg?repos=sh20raj/webscrapperjs\u0026type=Date\" /\u003e\n \u003c/picture\u003e\n\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsh20raj%2Fwebscrapperjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsh20raj%2Fwebscrapperjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsh20raj%2Fwebscrapperjs/lists"}