In this video,
we take a close look at how we can use the Network tab in
developer tools to help us find media links.
The developer tools Network tab gives us a different and
sometimes much deeper insight into where the data we're
viewing in the browser is coming from.
When scraping any website in particular for web media,
there are generally three steps to take when starting to analyze.
Identify the media element that you want to scrape.
In this instance, let's say it's an image.
Look in the page source and see if you can locate it.
Finally, if you cannot see it in the page source,
then go to the Network tab and search for it there using the search function.
In this page, we have identified that we want to locate and download
the image of the book. To find this, we can look for something that
we can see sits beside it, for example, in the page. I can see the book title,
so let's search for that.
We open the page source view and search for the string
that's near the image book title.
On this occasion,
it was found easily, and we can see the URL of the image we want downloaded
right beside it, and we can target that and download it.
Let's say, however, we didn't find it in the source page.
This means it's coming from someplace else.
So now we can open the Network tab, and we can check there again using
the search tools provided. Using the same search text,
which is book title, we can see the at the text is
actually contained in a CSS file.
So we can go there now, and we can investigate that. In the CSS file, we
can search for this string again, and we can see here that it's
contained inside a CSS class that actually defines the entire div that
the product data is contained within, along with a reference to the image.
The message to take away here is that if data media or
otherwise is displayed or accessed in a browser,
then it's most likely that you're able to track down where the
data is coming from by using the basic tools that are provided
in the browser developer section, including page source,
element inspector, application and source view, and finally,
by inspecting the network traffic.