I am 100% sure you have heard about this thing called ChatGPT, and you must have also heard how it is on the hunt to take people's jobs away. Artificial Intelligence is going to take away the jobs and eventually going to take over the world. If you have watched the Terminators series then you would know this all too well.

If you do not know what ChatGPT is, check out this article on ZDNET 'What is ChatGPT and why does it matter? Here's what you need to know'.

In this simple guide, we are going to talk about how Artificial Intelligence can make you life easy and help you get the required data quickly and effectively. In particular, we are going to show you how you can use ChatGPT to scrape Amazon for your specific needs.

image-1-chatgpt

Source: OpenAI

What is ChatGPT anyway?

Well, if you happen to be that special individual who needs a bot of introduction about ChatGPT. Well then, ChatGPT is like a very smart robot that can talk or chat with people through text. Imagine it as a digital helper that can answer questions, help with homework, write stories, and even make jokes, just like you're talking to a friend who knows a lot about almost everything.

You type something to it, and it types back an answer. It's not a person, but a computer program designed to understand and generate text in a way that feels natural and human-like. It learns from a vast amount of information to give responses that are informative, helpful, or just fun to read.

What can you use OpenAI's ChatGPT for?

ChatGPT can be used for a wide range of tasks, including but not limited to:

  1. Answering Questions: You can ask it about facts, history, science, or pretty much anything you're curious about, and it will try to provide an answer.
  2. Homework Help: Students can use it to understand complex topics, explain concepts in simple terms, or get help with their homework assignments.
  3. Writing Assistance: It can help you write essays, emails, reports, or even creative stories and poems.
  4. Learning New Languages: ChatGPT can assist in learning new languages by providing translations, explanations of grammar, and practice conversations.
  5. Programming Help: Programmers can use it to understand code, debug issues, or learn about new technologies and programming languages.
  6. Entertainment: It can generate jokes, stories, or even compose music lyrics and poems for entertainment.
  7. Advice and Recommendations: You can ask for advice on various topics like travel, cooking, personal development, or any other area of interest.
  8. Daily Tasks Assistance: It can help you create lists, organize your schedule, remind you of important tasks, or guide you through complex processes step by step.
  9. Business and Professional Use: Professionals can use it for generating content for marketing, drafting business plans, summarizing research, or even generating code snippets.
  10. Mental Health Support: While it's not a substitute for professional care, ChatGPT can provide general advice on coping strategies, mindfulness, and positive thinking exercises.

These examples illustrate the versatility of ChatGPT, making it a valuable tool for a wide range of users with diverse needs and interests.

Check out OpenAI's latest tool. It is amazing what this tool does. OpenAI Sora.

Wandering what are some great python libraries for web scraping?
Then, you will like our article where we talk about the best python libraries for both beginners and experts.
Read Now!

Web Scraping Tutorial Using ChatGPT

In this Guide, we will be talking about how you can scrape data from Amazon.

Let's assume you want to know the pricing of a certain gentre of books from Amazon.

First, lets head over to Amazon, now under the books section, let us look for books related to 'marketing'. Then hit search.

image-2-amazon-marketing-results-page

Now, you can see different books that are top-rated for marketing. Let's scrape data from this page.

First, we are going to save the page by either hitting 'Ctrl+S' and choosing save as 'HTML only'. Or we can right click and 'SELECT SAVE PAGE AS'.Now lets go to ChatGPT, if you do now have an account you will be required to sign-up for one. It's very straight forward.

Now once that is done, your screen should look something like this. For perform this task we will be using ChatGPT 4 which has the Code Analysis capability.

Learn more about the challenges one face in web scraping. Click here

Depending on new features and version you are using it might look slightly different.

Then, we are going to upload the html file we saved.

Coming back to the Amazon Page.

image-4-information-on-amazon

So, in our case we are looking at the Title of the Book, the Price and the Year it was published to be scraped from Amazon.

Now let's go back to the Amazon webpage and right click and select 'Inspect', so now we hover over the page to find the code of the elements we are interested in scraping from Amazon.

image-5-inspecting-elements

You can copy the HTML of each of these by right clicking and selecting 'Outer HTML'.

Once we go back to ChatGPT, we will first select the upload option and choose the html file we just saved. We will put in the following prompt that will help us extrac the elements that we want from the Amazon webpage.

Then we are going to enter the following command.

Hey ChatGPT, I require some help with scraping this webpage into a CSV  file, please scrape the following items only.

Title of book: <span class="a-size-medium a-color-base a-text-normal">The 1-Page  Marketing Plan: Get New Customers, Make More Money, And Stand Out From  the Crowd</span>

Price of book: <span class="a-offscreen">$14.76</span>

Publication Year: <span class="a-size-base a-color-secondary a-text-normal">May 5  2018</span>

Can you do this for all items please. If elements missing, make them  null data. I would like to download the CSV file, please.

image-6-chatgpt-input

Hit 'Enter', and watch the magic unfold.

image-7-chatgpt-results

Looking to challenge your Python skills? Dive into our list of advanced Python project ideas, perfect for honing your web scraping expertise.
Explore them now at Top Web Scraping Python Projects Ideas on DataHen’s blog.

And there you have it. Now, go ahead and download the CSV file.
This is what it is going to look like if you following along

image-8-data-in-excel

There you have it, we are able to extract clean data from HTML within minutes all without writing a single line of code, all thanks to ChatGPT.

Now, if you would like data like this for your business and are looking for specific needs. DataHen provides customized data according to your business needs. Go ahead and tell us more about you and your project information by clicking the link here.