-
Sep 9th, 2014, 01:46 PM
#1
[JavaScript] Get elements by class from external site
I'm wanting to know if it's possible to get all elements from an external website using JavaScript. Everything that I've read online seems to conflict each other.
Basically what I'm wanting to do is get the innerHTML from all elements who's class name is forumtitle on http://www.vbforums.com/forum.php. It doesn't necessarily have to be JavaScript, it's just that is what I'm comfortable with.
Also, I wanted to let y'all know that I've triple checked the AUP and it looks like what I'm doing is OK.
-
Sep 9th, 2014, 08:31 PM
#2
Re: [JavaScript] Get elements by class from external site
I'm guessing you will get blocked by Same Origin Policy in the browser if you go the JavaScript route. If you're scraping pages with a server-side or fat-client app, you wouldn't have those restrictions.
-
Sep 9th, 2014, 08:32 PM
#3
Re: [JavaScript] Get elements by class from external site
You would need CORS enabled on the server-side to get past the SOP restrictions.
-
Sep 9th, 2014, 09:25 PM
#4
Re: [JavaScript] Get elements by class from external site
I will take a look at CORS specification and post back here on my progress.
-
Sep 10th, 2014, 07:57 AM
#5
Re: [JavaScript] Get elements by class from external site
If you're simply looking to get the elements, and some value in them, but not actually manipulate them, you could simply scrape the source (using C#, python, etc) and use regex to parse out fields that have the class name you indicated.
Last edited by kfcSmitty; Sep 10th, 2014 at 08:07 AM.
-
Sep 10th, 2014, 09:00 AM
#6
Re: [JavaScript] Get elements by class from external site
Yeah, I'm not wanting to manipulate them. Only get the text of the forum's title. I found this website and I'm going to read up on that article.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|