Skip to content

Instantly share code, notes, and snippets.

@hancush
Last active October 11, 2019 15:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hancush/a96cf2cce0b2cd67defac2c311bd960f to your computer and use it in GitHub Desktop.
Save hancush/a96cf2cce0b2cd67defac2c311bd960f to your computer and use it in GitHub Desktop.
from lxml import etree
html = '''
<h3>Offense: A Tale of Two Halves</h3>
<p>For a while there, it seemed the Bears' offense might never show up in London. The unit generated just two first downs and 44 total yards in the first half. Then <strong>Chase Daniel</strong> s
tarted hitting his spots, aided with some stellar work by <strong>Allen Robinson</strong> and <strong>Anthony Miller</strong>, to get the rally going. Unfortunately, it was too little, too late wi
th the defense not playing at its best.</p>
<h5>By the numbers:</h5>
<ul>
<li><strong>194 PASSING YARDS:</strong> Daniel had some good moments in completing 22 of 30 passes for 231 yards, but <a href="https://chicago.suntimes.com/bears/2019/10/6/20901945/daniel-takes-th
e-blame-for-late-game-mishap">he also threw two interceptions</a> and got sacked four times. Several of his biggest plays were also the result of stellar catches by his receivers.</li>
<li><strong>42 RUSHING YARDS</strong>: <strong>David Montgomery</strong> scored the second touchdown of his career but finished with just 25 yards off 11 carries. An offensive line that struggled
to dominate the line of scrimmage didn't help the ground attack much.</li>
</ul>
<h5>Offensive play of the game:</h5>
<hr>
<h3>Defense: A Rubbish Evening in London</h3>
<p>This wasn't the <a href="https://chicago.suntimes.com/bears/2019/10/6/20901912/bears-defense-shows-up-late-to-the-party-in-loss-to-raiders-khalil-mack-matt-nagy-chase-daniel">Bears defense we'v
e been used</a> to seeing this season. Did the recent trip overseas take a toll? It's hard to say but the Raiders ended up finding success both on the ground and through the air.</p>
<p>If it weren't for some bad penalties and turnovers by the opposing offense, Oakland might've scored even more points. And when the "D" had a chance to put things away late, the Raiders powered
97 yards on the go-ahead drive. Let's hope these issues stay confined to England.</p>
<h5>By the numbers:</h5>
<ul>
<li><strong>398 TOTAL YARDS ALLOWED</strong> -- 229 passing, 169 rushing</li>
<li><strong>0 SACKS</strong>: Zilch. Zip.</li>
<li><strong>2 TAKEAWAYS</strong>: <strong>Sherrick McManis</strong>' Peanut Punch (see below) and the wild failed <strong>Derek Carr</strong>-Jacobs pitch</li>
</ul>
<h5>Defensive play of the game:</h5>
<hr>
<h3>Special Teams: Tarik Cohen Goes On A Run</h3>
<p>On a day when <strong>Eddy Pineiro</strong> didn't even attempt a field goal, Cohen delivered the fireworks with a 71-yard punt return that set up a touchdown.</p>
<h5>By the numbers:</h5>
<ul>
<li>Pineiro: 3-of-3 XP</li>
</ul>
<p>Here's that big-time return from Cohen:</p>
<hr>
'''
tree = etree.HTML(html)
tree
# <Element html at 0x11016b4c8>
body, = tree.iterchildren()
body
# <Element body at 0x11020e4c8>
list(body.iterchildren())
#[<Element h3 at 0x110a64948>,
# <Element p at 0x110a82e08>,
# <Element h5 at 0x110b25c88>,
# <Element ul at 0x110b25b88>,
# <Element h5 at 0x110b25d48>,
# <Element hr at 0x110b25088>,
# <Element h3 at 0x110b25d88>,
# <Element p at 0x110b25348>,
# <Element p at 0x110b25ec8>,
# <Element h5 at 0x110b25dc8>,
# <Element ul at 0x110b25f48>,
# <Element h5 at 0x110b25788>,
# <Element hr at 0x110b25e88>,
# <Element h3 at 0x110b25e48>,
# <Element p at 0x110b25548>,
# <Element h5 at 0x110b25fc8>,
# <Element ul at 0x110b25908>,
# <Element p at 0x110b25a88>,
# <Element hr at 0x110b25c08>]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment