Skip to content
Advertisement

Using getlementbyclass name or getlementbytag to scrape data from html content

Here I have taken source code snipper from webpage : http://www.yelp.com/biz/franchino-san-francisco?start=80.

I want to scrape date, review, rate for each block on the page.

@: http://ideone.com/fork/Yfw2re

I am not much familiar with DOM element, I appreciate if someone can correct this

Here is the code :

JavaScript

Advertisement

Answer

you can loop through the class values or tag names like this :

JavaScript

you can obviously loop the rating part to get all the ratings on the page using a simple for loop.

demo here : https://eval.in/143036

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement