Python Web Scraping Cookbook
上QQ阅读APP看书,第一时间看更新

How to do it

Here is how we proceed with the recipe:

  1. The URLUtility class can download content from a URL.  The code in the recipe's file is the following:
import const
from
util.urls import URLUtility

util = URLUtility(const.ApodEclipseImage())
print(len(util.data))
  1. When running this you will see the following output:
Reading URL: https://apod.nasa.gov/apod/image/1709/BT5643s.jpg
Read 171014 bytes
171014

The example reads 171014 bytes of data.