Scraping with Python

Click here for Preparation for Beautiful Soup

I haven't been motivated recently, so I decided to write it for the time being. It ’s really the foundation of the foundation, so it ’s not bad.

For now, let's run Beautiful Soup.

from urllib.request import urlopen
from bs4 import BeautifulSoup

#Page to get
html = urlopen('http://www.pythonscraping.com/pages/page1.html')
bs = BeautifulSoup(html.read(), 'html.parser')
#Returns the h1 tag
print(bs.h1)

2nd line

from bs4 import BeautifulSoup

Import Beautiful Soup in the part. The execution result is as follows. WS000000.JPG

http://www.pythonscraping.com/pages/page1.html You can see that only the h1 tag on the above page can be obtained.

Next time, I will post with proper content.

References

Web scraping with Python (O'Reilly Japan)

Recommended Posts

Scraping with Python
Scraping with Python (preparation)
Try scraping with Python.
Scraping with Python + PhantomJS
Scraping with Selenium [Python]
Scraping with Python + PyQuery
Scraping RSS with Python
[Scraping] Python scraping
I tried scraping with Python
Scraping with selenium in Python
Scraping with chromedriver in python
Festive scraping with Python, scrapy
Scraping with Selenium in Python
Scraping with Tor in Python
Scraping weather forecast with python
Scraping with Selenium + Python Part 2
I tried scraping with python
Web scraping beginner with python
Python scraping notes
Scraping with selenium
Try scraping with Python + Beautiful Soup
Scraping with selenium ~ 2 ~
Statistics with python
Web scraping with Python ① (Scraping prior knowledge)
Scraping with Selenium in Python (Basic)
Python with Go
Scraping with Python, Selenium and Chromedriver
Web scraping with Python First step
I tried web scraping with python.
Scraping with Python and Beautiful Soup
Twilio with Python
Integrate with Python
Python Scraping eBay
Play with 2016-Python
AES256 with python
Tested with Python
Scraping with Selenium
python starts with ()
Python Scraping get_title
with syntax (Python)
Let's do image scraping with Python
Python: Scraping Part 1
Get Qiita trends with Python scraping
Bingo with python
Zundokokiyoshi with python
"Scraping & machine learning with Python" Learning memo
Scraping using Python
Get weather information with Python & scraping
Excel with Python
Microcomputer with Python
Python: Scraping Part 2
Cast with python
Get property information by scraping with python
WEB scraping with Python (for personal notes)
Automate simple tasks with Python Part1 Scraping
Getting Started with Python Web Scraping Practice
I tried scraping Yahoo News with Python
[Personal note] Web page scraping with python3
Web scraping with Python ② (Actually scraping stock sites)
Horse Racing Site Web Scraping with Python
Getting Started with Python Web Scraping Practice