Web scraping(bookstore) project
use web scraping to scrap the html file data from the bookstore website. Website: http://search.books.com.tw/search/query/key/python/cat/all
Try to create a detailed csv dataset including author,price,publisher,table of content...from the website. The csv file would include top 20 books' content with when searching "Python" on this bookstore website.
Below are the steps of this pytharm file:
- scrap the html local file and store the file as bookstore.html.
- Open the html file, then use lxml tree to extract the title of these books first.
- Extract the html page of each book.
- Download those html files and rename them with the title we got from step 2.
- Read the file from the html file
- Use Xpath to extract the element from the website and store the value in an empty dictionary.
- Do some data cleaning and examination job, because some of the book website may have different Xpath.
- Export the file and store as python_book.csv file.