Getting Started with Beautiful Soup

Learn how to extract information from websites using Beautiful Soup and the Python urllib2 module. This practical, hands-on guide covers everything you need to know to get a head start in website scraping.

Getting Started with Beautiful Soup

Starting
Vineeth G. Nair

Learn how to extract information from websites using Beautiful Soup and the Python urllib2 module. This practical, hands-on guide covers everything you need to know to get a head start in website scraping.
$10.00
$34.99
RRP $20.99
RRP $34.99
eBook
Print + eBook
$12.99 p/month

Get Access

Get Unlimited Access to every Packt eBook and Video course

Enjoy full and instant access to over 3000 books and videos – you’ll find everything you need to stay ahead of the curve and make sure you can always get the job done.

+ Collection
Free Sample

Book Details

ISBN 139781783289554
Paperback130 pages

About This Book

  • Learn about the features of Beautiful Soup with Python
  • Understand how to use a simple method to extract information from websites using Beautiful Soup and the Python urllib2 module
  • Master searching, navigation, content modification, encoding, and output methods quickly and efficiently
  • Try out the example code and get to grips with Beautiful Soup easily

Who This Book Is For

Getting Started with Beautiful Soup is great for anybody who is interested in website scraping and extracting information. However, a basic knowledge of Python, HTML tags, and CSS is required for better understanding.

Table of Contents

Chapter 1: Installing Beautiful Soup
Installing Beautiful Soup
Using Beautiful Soup without installation
Verifying the installation
Quick reference
Summary
Chapter 2: Creating a BeautifulSoup Object
Creating a BeautifulSoup object
Tag
The NavigableString object
Quick reference
Summary
Chapter 3: Search Using Beautiful Soup
Searching in Beautiful Soup
Using search methods to scrape information from a web page
Quick reference
Summary
Chapter 4: Navigation Using Beautiful Soup
Navigation using Beautiful Soup
Quick reference
Summary
Chapter 5: Modifying Content Using Beautiful Soup
Modifying Tag using Beautiful Soup
Modifying string contents
Deleting tags from the HTML document
Special functions to modify content
Quick reference
Summary
Chapter 6: Encoding Support in Beautiful Soup
Encoding in Beautiful Soup
Output encoding
Quick reference
Summary
Chapter 7: Output in Beautiful Soup
Formatted printing
Unformatted printing
Output formatters in Beautiful Soup
Using get_text()
Quick reference
Summary
Chapter 8: Creating a Web Scraper
Getting book details from PacktPub.com
Getting selling prices from Amazon
Getting the selling price from Barnes and Noble
Summary

What You Will Learn

  • Learn how to scrape HTML pages from websites
  • Implement a simple method to scrape any website with the help of developer tools, the Python urllib2 module, and Beautiful Soup
  • Learn how to search for information within an HTML/XML page
  • Modify the contents of an HTML tree
  • Understand encoding support in Beautiful Soup
  • Learn about the different types of output formatting

In Detail

Beautiful Soup is a Python library designed for quick turnaround projects like screen-scraping. Beautiful Soup provides a few simple methods and Pythonic idioms for navigating, searching, and modifying a parse tree: a toolkit for dissecting a document and extracting what you need without writing excess code for an application. It doesn't take much code to write an application using Beautiful Soup.

Getting Started with Beautiful Soup is a practical guide to Beautiful Soup using Python. The book starts by walking you through the installation of each and every feature of Beautiful Soup using simple examples which include sample Python codes as well as diagrams and screenshots wherever required for better understanding. The book discusses the problems of how exactly you can get data out of a website and provides an easy solution with the help of a real website and sample code.

Getting Started with Beautiful Soup goes over the different methods to install Beautiful Soup in both Linux and Windows systems. You will then learn about searching, navigating, content modification, encoding support, and output formatting with the help of examples and sample Python codes for each example so that you can try them out to get a better understanding. This book is a practical guide for scraping information from any website. If you want to learn how to efficiently scrape pages from websites, then this book is for you.

Authors

Table of Contents

Chapter 1: Installing Beautiful Soup
Installing Beautiful Soup
Using Beautiful Soup without installation
Verifying the installation
Quick reference
Summary
Chapter 2: Creating a BeautifulSoup Object
Creating a BeautifulSoup object
Tag
The NavigableString object
Quick reference
Summary
Chapter 3: Search Using Beautiful Soup
Searching in Beautiful Soup
Using search methods to scrape information from a web page
Quick reference
Summary
Chapter 4: Navigation Using Beautiful Soup
Navigation using Beautiful Soup
Quick reference
Summary
Chapter 5: Modifying Content Using Beautiful Soup
Modifying Tag using Beautiful Soup
Modifying string contents
Deleting tags from the HTML document
Special functions to modify content
Quick reference
Summary
Chapter 6: Encoding Support in Beautiful Soup
Encoding in Beautiful Soup
Output encoding
Quick reference
Summary
Chapter 7: Output in Beautiful Soup
Formatted printing
Unformatted printing
Output formatters in Beautiful Soup
Using get_text()
Quick reference
Summary
Chapter 8: Creating a Web Scraper
Getting book details from PacktPub.com
Getting selling prices from Amazon
Getting the selling price from Barnes and Noble
Summary

Book Details

ISBN 139781783289554
Paperback130 pages
Read More

Recommended for You

Instant jsoup How-to
$ 10.00
Sony Vegas Pro 11 Beginner's Guide
$ 10.00
Building Websites with XOOPS : A step-by-step tutorial
$ 9.00