View Single Post
Old 09-03-2010, 07:01 PM   #2615
TonytheBookworm
Addict
TonytheBookworm is on a distinguished road
 
TonytheBookworm's Avatar
 
Posts: 264
Karma: 62
Join Date: May 2010
Device: kindle 2, kindle 3, Kindle fire
if you were faced with something like this how would you remove it?
take a look at link : http://www.nfl.com/gamecenter/201009...cap/full-story
notice it has the fantasy football in it..
Spoiler:

Code:
<div style="">
<div style="margin: 5px; font-size: 11px; float: right; padding: 10px; background-color: rgb(255, 255, 255); border: 1px solid rgb(204, 204, 204); font-family: arial; width: 255px;">
<table>
<tbody><tr>
<td>
</td>
</tr>
<tr>
<td>
<a href="http://fantasy.nfl.com/" onclick="s_objectID=&quot;http://fantasy.nfl.com/_3&quot;;return this.s_oc?this.s_oc(e):true"><img border="0" class="teamslandinggrid" src="http://static.nfl.com/static/content/catch_all/nfl_image/Fantasy_250x150_1.jpg"></a>
</td>
</tr>
<tr>
<td colspan="3">
<br><b>2010 NFL.com fantasy football games</b>
<br>» <a href="http://fantasy.nfl.com/registration/privateleaguecreate" onclick="s_objectID=&quot;http://fantasy.nfl.com/registration/privateleaguecreate_1&quot;;return this.s_oc?this.s_oc(e):true">Create a customizable league</a>
<br>» <a href="http://fantasy.nfl.com/registration/leagueDirectory?leagueType=private" onclick="s_objectID=&quot;http://fantasy.nfl.com/registration/leagueDirectory?leagueType=private_1&quot;;return this.s_oc?this.s_oc(e):true">Join a custom private league</a>
<br>» <a href="http://fantasy.nfl.com/registration/leagueDirectory" onclick="s_objectID=&quot;http://fantasy.nfl.com/registration/leagueDirectory_1&quot;;return this.s_oc?this.s_oc(e):true">Join an NFL-managed league</a>
<br>» <a href="http://fantasy.nfl.com/draftcenter/mockdrafts" onclick="s_objectID=&quot;http://fantasy.nfl.com/draftcenter/mockdrafts_1&quot;;return this.s_oc?this.s_oc(e):true">Join a 10-team mock draft</a>
<br>
<br><b>Dominate your fantasy football draft!</b>
<br>» <a href="http://www.nfl.com/fantasy/draftkit" onclick="s_objectID=&quot;http://www.nfl.com/fantasy/draftkit_1&quot;;return this.s_oc?this.s_oc(e):true">NFL.com's in-depth draft kit</a>
<br>» <a href="http://www.nfl.com/fantasy/rankings" onclick="s_objectID=&quot;http://www.nfl.com/fantasy/rankings_1&quot;;return this.s_oc?this.s_oc(e):true">2010 fantasy player rankings</a>
<br>» <a href="http://www.nfl.com/goto?id=09000d5d817fb977" onclick="s_objectID=&quot;http://www.nfl.com/goto?id=09000d5d817fb977_1&quot;;return this.s_oc?this.s_oc(e):true">Complete profiles/projections</a>
<br>» <a href="http://www.nfl.com/fantasy" onclick="s_objectID=&quot;http://www.nfl.com/fantasy_1&quot;;return this.s_oc?this.s_oc(e):true">NFL.com Fantasy home page</a>
<br>
</td>
</tr>
</tbody></table>
</div></div>


I've tried doing a
Code:
remove_tags =[dict(attrs={'style':[""]})]
I even tried
Code:
def postprocess_html(self, soup):
         for tag in soup.findAll(attrs ={'style':[' ']}):
             tag.extract()
         return soup
all with no sucess. Am I just picking hard stuff to figure out or just common problems with someone just learning this stuff?
TonytheBookworm is offline