WebScrapperJS – Get Content/HTML of any website without being blocked by CORS even using JavaScript by WhollyAPI

WebScrapperJS

WebScrapperJS – Get Content/HTML of any website without being blocked by CORS even using JavaScript by WhollyAPI

Website :- https://sh20raj.github.io/WebScrapperJS/

GitHub | Repl.it | Dev.to Article

G…


This content originally appeared on DEV Community and was authored by Shaswat Raj

WebScrapperJS

WebScrapperJS - Get Content/HTML of any website without being blocked by CORS even using JavaScript by WhollyAPI


Website :- https://sh20raj.github.io/WebScrapperJS/

GitHub | Repl.it | Dev.to Article

Grab the CDN or Download the JavaScript File

<script src="https://cdn.jsdelivr.net/gh/SH20RAJ/WebScrapperJS/WebScrapper.min.js" ></script>

To Get HTML Content of Any Website

var url = 'https://google.com/';
var html = WebScrapper.gethtml(url);//html of the url will be stored in this variable
console.log(html);

Intialise own WebScrapper with URL

let MyWebScrapper = new scrapper('https://example.com/');
//You can now directly call gethtml() instead of passing a url into it.

console.log(MyWebScrapper.gethtml()); //Grab https://example.com/ and print on console

Still you can Use new created scrapper MyWebScrapper for grabbing new URLs. Like

let MyWebScrapper = new scrapper('https://example.com/');
//You can now directly call gethtml() instead of passing a url into it.

console.log(MyWebScrapper.gethtml()); //Grab https://example.com/ and print on console

console.log(MyWebScrapper.gethtml('https://example.com/')); //Grab https://youtube.com/ and print on console

Try this on Codepen

Sample Code | Codepen :- https://codepen.io/SH20RAJ/pen/VwrwjXJ?editors=1001

<div id="scrappedcontent"></div>

<script src="https://cdn.jsdelivr.net/gh/SH20RAJ/WebScrapperJS/WebScrapper.min.js" ></script> 
<script>
  let MyWebScrapper = new scrapper('https://google.com/');
//You can now directly call gethtml() instead of passing a url into it.

console.log(MyWebScrapper.gethtml()); //Grab https://example.com/ and print on console
var html = MyWebScrapper.gethtml('https://example.com/');

console.log(html); //Grab https://youtube.com/ and print on console

document.getElementById('scrappedcontent').innerHTML = html;
</script>

See Results Here


This content originally appeared on DEV Community and was authored by Shaswat Raj


Print Share Comment Cite Upload Translate Updates
APA

Shaswat Raj | Sciencx (2022-01-25T12:45:22+00:00) WebScrapperJS – Get Content/HTML of any website without being blocked by CORS even using JavaScript by WhollyAPI. Retrieved from https://www.scien.cx/2022/01/25/webscrapperjs-get-content-html-of-any-website-without-being-blocked-by-cors-even-using-javascript-by-whollyapi/

MLA
" » WebScrapperJS – Get Content/HTML of any website without being blocked by CORS even using JavaScript by WhollyAPI." Shaswat Raj | Sciencx - Tuesday January 25, 2022, https://www.scien.cx/2022/01/25/webscrapperjs-get-content-html-of-any-website-without-being-blocked-by-cors-even-using-javascript-by-whollyapi/
HARVARD
Shaswat Raj | Sciencx Tuesday January 25, 2022 » WebScrapperJS – Get Content/HTML of any website without being blocked by CORS even using JavaScript by WhollyAPI., viewed ,<https://www.scien.cx/2022/01/25/webscrapperjs-get-content-html-of-any-website-without-being-blocked-by-cors-even-using-javascript-by-whollyapi/>
VANCOUVER
Shaswat Raj | Sciencx - » WebScrapperJS – Get Content/HTML of any website without being blocked by CORS even using JavaScript by WhollyAPI. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2022/01/25/webscrapperjs-get-content-html-of-any-website-without-being-blocked-by-cors-even-using-javascript-by-whollyapi/
CHICAGO
" » WebScrapperJS – Get Content/HTML of any website without being blocked by CORS even using JavaScript by WhollyAPI." Shaswat Raj | Sciencx - Accessed . https://www.scien.cx/2022/01/25/webscrapperjs-get-content-html-of-any-website-without-being-blocked-by-cors-even-using-javascript-by-whollyapi/
IEEE
" » WebScrapperJS – Get Content/HTML of any website without being blocked by CORS even using JavaScript by WhollyAPI." Shaswat Raj | Sciencx [Online]. Available: https://www.scien.cx/2022/01/25/webscrapperjs-get-content-html-of-any-website-without-being-blocked-by-cors-even-using-javascript-by-whollyapi/. [Accessed: ]
rf:citation
» WebScrapperJS – Get Content/HTML of any website without being blocked by CORS even using JavaScript by WhollyAPI | Shaswat Raj | Sciencx | https://www.scien.cx/2022/01/25/webscrapperjs-get-content-html-of-any-website-without-being-blocked-by-cors-even-using-javascript-by-whollyapi/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.