Parsing XML from a webpage

ParseErrorParsing XML from a webpage

import urllib.request
import xml.etree.ElementTree as ET

url = ‘http://www.oxfordlearnersdictionaries.com/us/definition/english/felicity

f = urllib.request.urlopen(url)
data = f.read().decode(“utf-8”)

print(len(data))

root = ET.fromstring(data)
-> ParseError

print_line

>>from bs4 import BeautifulSoup
>>>
>>>html_tag = BeautifulSoup(data)(‘html’)[0]
bs4_element

XML instance:
https://d18ky98rnyall9.cloudfront.net/aFJF93QMEeWtlRLKY8QGgw.processed/full/360p/index.mp4

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s