This course is general information for learning, not legal advice. For business use of collected data, ask a lawyer.
By the end of this lesson you will know the four ways to get data from a website, in the order you should try them, and you will try the easiest way first before anyone writes a scraper.
You need: a browser and a Google account (for Google Sheets) · Time: 7 minutes
Neha is a BBA student in Pune. For her project she needs rainfall numbers for every state, and the prices of 50 books from an online store. Copying them by hand would take a whole weekend. Five words help her think about it:
- Web data: any information shown on a website: prices, tables, lists, numbers.
- CSV: a plain file of rows and columns separated by commas. Excel and Google Sheets open it directly.
- API: a door a website builds on purpose so programs can ask for its data and get a clean answer.
- JSON: the text format most APIs answer in, with labels and values, like
"price": 51.77. - Scraping: a program that opens web pages like a browser and copies data out of them.
Why?With an AI agent, writing a scraper takes five minutes, so it's tempting to start there. But scraping is the slowest, most fragile and most risky way to get data. Knowing the other ways saves you time and trouble.
Think of your options as a ladder. Start at the top and climb down only if the rung above doesn't work:
Each rung down means more work, more breakage and more risk. Why?Higher rungs give you data the owner chose to share, in a clean format that doesn't break when the website's design changes. A scraper breaks every time someone moves a button.
Many websites already give data away. Look for words like Download, Export, CSV, Excel or Data near a table, at the bottom of the page, or in the menu.
For Indian public data, start with data.gov.in, the government's Open Government Data Platform. Neha searches it for "rainfall" and finds state-wise rainfall tables she can download as a file. Most datasets there are shared under the Government Open Data License – India, which allows reuse if you credit the source.
Before you ask your agent to build anything, ask it to look for an easier way:
Prompt · copy it into your AI agentI need [state-wise annual rainfall for the last 10 years] for a college project, in a CSV file I can open in Google Sheets. Before writing any scraper, find out: does [data.gov.in or the website I name] offer this as a download (CSV or Excel), an official API, or an RSS feed? Give me the exact links and what each one contains. Only suggest scraping if none of these exist, and tell me why.
Why?A downloaded file is complete, correct and allowed. In five minutes you have what a scraper might take a day to collect, with no risk of breaking any rule.
If there is no download button, look for an API link, often at the bottom of the site under "Developers", "API" or "Data". An API usually needs a free API key (a password-like code that identifies you), and it has limits, like 1,000 requests a day. data.gov.in, for example, offers an API for many datasets once you sign in.
An API answers with clean JSON. Here is what one row might look like:
JSON{ "state": "Kerala", "year": 2024, "annual_rainfall_mm": 2890.4 }Your agent can turn answers like this into a CSV in minutes. Keep your API key out of any file you share, the same way you keep any key secret (see Keep secrets secret).
Why?An API is the owner saying "programs welcome, here's how". You get exactly the fields you need, and you know the limits up front instead of discovering them by getting blocked.
Rung 3: feeds and sitemaps. News sites and blogs often have an RSS feed, a list of their latest posts made for programs to read. Many sites also have a
sitemap.xml: a list of all their pages that they publish for search engines. Both are lists the site gives out on purpose.Rung 4: scraping, only when nothing above works, and only after the checks in the next lesson.
Stuck? Email the owner. Small businesses, NGOs and government offices often say yes to a polite request from a student:
Prompt · copy it into your AI agentWrite a short, polite email to [the office of the Pune Municipal Corporation] asking for [ward-wise water supply data for 2025] as a CSV or Excel file. Explain that I am a [BBA student at XYZ College] using it for a college project, that I will credit them as the source, and that I won't share personal data. Keep it under 120 words.
Match them Match each situation with the rung to use
Tap an item on the left, then its meaning on the right.
Why?Asking takes one email and can save a week. And if the owner says no, you've learned that scraping would have been against their wishes too.
Neha needs book prices from a store. The site has no download, no API and no feed. Rahul, her friend, says "just scrape it tonight, all pages, as fast as possible".
- Web data comes from four rungs: download, official API, feeds and sitemaps, then scraping.
- Always start at the top: a file the owner gives you is complete, correct and allowed.
- data.gov.in is the first stop for Indian public data; many datasets download as files, and many have an API.
- Ask your agent to look for a download or API before it writes any scraper; if nothing fits, email the owner.
- Next: Read robots.txt and the terms before you collect anything.
Create a free account to save your progress and open every lesson. Create free account