HTML Tags and Attributes

Web Scraping in Python

Thomas Laetsch

Data Scientist, NYU

Do we have to?

  • Information within HTML tags can be valuable
  • Extract link URLs
  • Easier way to select elements
Web Scraping in Python

Tag, you're it!

abstract_tag.png

  • We've seen tag names such as html, div, and p.
  • The attribute name is followed by = followed by information assigned to that attribute, usually quoted text.
Web Scraping in Python

Let's "div"vy up the tag

div_tag.png

  • id attribute should be unique
  • class attribute doesn't need to be unique
Web Scraping in Python

"a" be linkin'

a_tag.png

  • a tags are for hyperlinks
  • href attribute tells what link to go to
Web Scraping in Python

Tag Traction

html_tags.png

Web Scraping in Python

Et Tu, Attributes?

Web Scraping in Python

Preparing Video For Download...