diff --git a/Gemfile b/Gemfile
new file mode 100644
index 00000000..72d5d6b3
--- /dev/null
+++ b/Gemfile
@@ -0,0 +1,6 @@
+source 'https://rubygems.org'
+
+gem 'nokogiri'
+
+# For Testing
+gem 'rspec'
diff --git a/Gemfile.lock b/Gemfile.lock
new file mode 100644
index 00000000..f8dfa368
--- /dev/null
+++ b/Gemfile.lock
@@ -0,0 +1,45 @@
+GEM
+ remote: https://rubygems.org/
+ specs:
+ diff-lcs (1.5.1)
+ nokogiri (1.17.2-aarch64-linux)
+ racc (~> 1.4)
+ nokogiri (1.17.2-arm-linux)
+ racc (~> 1.4)
+ nokogiri (1.17.2-arm64-darwin)
+ racc (~> 1.4)
+ nokogiri (1.17.2-x86-linux)
+ racc (~> 1.4)
+ nokogiri (1.17.2-x86_64-darwin)
+ racc (~> 1.4)
+ nokogiri (1.17.2-x86_64-linux)
+ racc (~> 1.4)
+ racc (1.8.1)
+ rspec (3.13.0)
+ rspec-core (~> 3.13.0)
+ rspec-expectations (~> 3.13.0)
+ rspec-mocks (~> 3.13.0)
+ rspec-core (3.13.2)
+ rspec-support (~> 3.13.0)
+ rspec-expectations (3.13.3)
+ diff-lcs (>= 1.2.0, < 2.0)
+ rspec-support (~> 3.13.0)
+ rspec-mocks (3.13.2)
+ diff-lcs (>= 1.2.0, < 2.0)
+ rspec-support (~> 3.13.0)
+ rspec-support (3.13.2)
+
+PLATFORMS
+ aarch64-linux
+ arm-linux
+ arm64-darwin
+ x86-linux
+ x86_64-darwin
+ x86_64-linux
+
+DEPENDENCIES
+ nokogiri
+ rspec
+
+BUNDLED WITH
+ 2.6.1
diff --git a/README.md b/README.md
index 4d5a093f..8b92b906 100644
--- a/README.md
+++ b/README.md
@@ -1,28 +1,32 @@
-# Extract Van Gogh Paintings Code Challenge
-
-Goal is to extract a list of Van Gogh paintings from the attached Google search results page.
-
-
-
-## Instructions
-
-This is already fully supported on SerpApi. ([relevant test], [html file], [sample json], and [expected array].)
-Try to come up with your own solution and your own test.
-Extract the painting `name`, `extensions` array (date), and Google `link` in an array.
-
-Fork this repository and make a PR when ready.
-
-Programming language wise, Ruby (with RSpec tests) is strongly suggested but feel free to use whatever you feel like.
-
-Parse directly the HTML result page ([html file]) in this repository. No extra HTTP requests should be needed for anything.
-
-[relevant test]: https://github.com/serpapi/test-knowledge-graph-desktop/blob/master/spec/knowledge_graph_claude_monet_paintings_spec.rb
-[sample json]: https://raw.githubusercontent.com/serpapi/code-challenge/master/files/van-gogh-paintings.json
-[html file]: https://raw.githubusercontent.com/serpapi/code-challenge/master/files/van-gogh-paintings.html
-[expected array]: https://raw.githubusercontent.com/serpapi/code-challenge/master/files/expected-array.json
-
-Add also to your array the painting thumbnails present in the result page file (not the ones where extra requests are needed).
-
-Test against 2 other similar result pages to make sure it works against different layouts. (Pages that contain the same kind of carrousel. Don't necessarily have to be paintings.)
-
-The suggested time for this challenge is 4 hours. But, you can take your time and work more on it if you want.
+# SerpApi Code Challenge
+
+This is a solution to the SerpApi Code Challenge.
+Creates a class `GoogleHtmlParser` that can be used to scrape Google search results pages and then saves the results to a JSON file.
+
+- `scraper.rb` is the file that executes the scraper.
+- `document_parser.rb` is the parent class to handle the demo mode logic and the parsing of the HTML file.
+- `google_html_parser.rb` is the class that encapsulates the logic to parse the Google search results page.
+- `carousel_item_parser.rb` is the class that parses the carousel items and extracts the name, link, image, and extensions.
+- `image_map.rb` is the class that creates the hash mapping image id to image url from the HTML file.
+
+To run tests:
+```
+bundle install
+bundle exec rspec
+```
+
+To run the scraper:
+```
+bundle install
+ruby scraper.rb
+```
+
+The demo mode is set to true if the file being scraped is `van-gogh-paintings.html`. which is the test file provided in the challenge.
+I found searched up two other similar result pages to test the scraper against. The demo mode is needed to differentiate between the test file and the other two because they have different layouts.
+
+# Challenges
+
+1. Different layouts for the carousel items on certain search results pages.
+2. Getting used to the Nokogiri gem and its methods.
+3. Refactoring the code to be more readable and maintainable.
+4. Took a little longer than expected to get the hang of the gem and the methods.
\ No newline at end of file
diff --git a/files/da-vinci-artworks.html b/files/da-vinci-artworks.html
new file mode 100644
index 00000000..676c8ac6
--- /dev/null
+++ b/files/da-vinci-artworks.html
@@ -0,0 +1,35 @@
+
Leonardo di ser Piero da Vinci was an Italian polymath of the High Renaissance who was active as a painter, draughtsman, engineer, scientist, theorist, sculptor, and architect.Wikipedia
https://www.britannica.com › list › 10-famous-artworks-...
10 Famous Artworks by Leonardo da Vinci · Mona Lisa (c. 1503–19) · Last Supper (c. 1495–98) · Vitruvian Man (c. 1490) · Self Portrait (c. 1490/1515–16) · The ...
https://en.wikipedia.org › wiki › List_of_works_by_Le...
Only around eight major works—The Adoration of the Magi, Saint Jerome in the Wilderness, the Louvre Virgin of the Rocks, The Last Supper, the ceiling of the ...
People also ask
Who bought the $450 million dollar painting?
What artwork did Leonardo da Vinci make?
What is Da Vinci's most valuable painting?
What is the #1 most famous painting in the world?
Feedback
Images
10 Famous Artworks by Leonardo da Vinci | Britannica
Britannica
10 Famous Artworks by Leonardo da Vinci | Britannica
Britannica
The Most Famous Works of Leonardo Da Vinci | Arthive
During his second period in Florence (1500-1508), he painted his most famous work, the Mona Lisa (ca. 1503-1519). By 1508, Leonardo returned to Milan, working ...
Two of his most famous works The Last Supper (1495–1498) and Mona Lisa (1503–1517), are among the most reproduced images ever made, both demonstrating Da ...
Leonardo's Last Supper, on the end wall of the refectory of Santa Maria delle Grazie in Milan, is one of the most renowned paintings of the High Renaissance.
\ No newline at end of file
diff --git a/files/pablo-picasso-artworks.html b/files/pablo-picasso-artworks.html
new file mode 100644
index 00000000..77cfeac2
--- /dev/null
+++ b/files/pablo-picasso-artworks.html
@@ -0,0 +1,36 @@
+pablo picasso artowrks - Google Search
Geometric forms fragment a vertical composition containing a woodgrain table with newspapers, a guitar, Abstraction (Guitar and Glass), 1913. Juan Gris ...
https://en.wikipedia.org › wiki › List_of_Picasso_artwo...
This is a partial list of artworks produced by Pablo Picasso from 1901 to 1910. Pablo Picasso, 1901, Old Woman (Woman with Gloves), oil on cardboard, ...
Throughout the long course of his career, he created more than 20,000 paintings, drawings, sculptures, ceramics and other items such as costumes and theater ...
Pablo Picasso: List of works - All Artworks by Date 1→10 · The picador - Pablo Picasso · House in the field - Pablo Picasso · Plaster male torso - Pablo Picasso.
Dec 18, 2023 — 12 Famous Paintings by Pablo Picasso · 1. Guernica (1937) · 2. The Old Guitarist (1903) · 3. The Weeping Woman (1937) · 4. Le Rêve (1932) · 5.
Jun 7, 2022 — 1. Self-Portrait, The beginning of his “Blue Period” · 2. Guernica, Or the horror of the war · 3. Les Demoiselles d'Avignon, Between Cubism and ...