How to fetch data from web
Let's start,
We want to fetch all the movies of some actress say Lindsay lohan into excel or any other format you want. let's go to imdb and search for lindsay lohan, you will get a page, scroll to the movie section and right click on the any movie name as below.
here, we can see "Scrape similar" (make sure you have downloaded scraper extension on chrome), click on that
above, you can see a scroll down option , choose Xpath.
see, on the very right of that, there is a textbox in which we have to the give the path of that element(in our case movies) in html, how to fetch path?
right click on movie name and click on "Inspect element", there you can see a hierarchy of elements as
<body>...
<div>...
<div>.....
.
.
.
<b>...
<a>
under this <a> tag, lies our movie name, so the path becomes
//body/div/div/div/div/div/div/div/div/div/b/a
Type above path in that textbox and "Enter"
you will see,
movie names in the side panel(see in the above picture)
you can also create another tab for some other detail(e.g. Date of release).
This data can be export to google docs.
This is how we can fetch any sort of data through scrapper available on net.
continue at :
WIll see something interesting in next post
till then Happy learning!!!
No comments:
Post a Comment