This is my (very) first blog post! I am a soon-to-be Ph.D. student in the department of political science at UC San Diego. And I plan to blog about political science, text as data, and China frequently in the future.
This blog post is a quick guide to the people who want to use Beautiful Soup, an awesome Python library, for their scraping projects. In the context of text analysis, Beautiful Soup saves a lot of time when you parse files such as HTML documents.
Here’s how you install Beautiful Soup on your Mac —
0. Use Python 2.7 (instead of 3)
1. Install Beautiful Soup
1.1 Download “beautifulsoup4-4.4.1.tar.gz” from here
1.2 Type Terminal in Spotlight to open Terminal
1.2.1 In Terminal, change working directory, for example, I type
$ cd /Users/Shane/Desktop/beautifulsoup4-4.4.1
1.2.2 In Terminal, type python setup.py install
1.3 Launch Python and type
from bs4 import BeautifulSoup