Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions wpull/scraper/html.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ class ElementWalker(object):
LINK_ATTRIBUTES = frozenset([
'action', 'archive', 'background', 'cite', 'classid',
'codebase', 'data', 'href', 'longdesc', 'profile', 'src',
'poster',
'usemap',
'dynsrc', 'lowsrc',
])
Expand Down Expand Up @@ -293,6 +294,9 @@ class ElementWalker(object):
'table': {'background': ATTR_INLINE},
'td': {'background': ATTR_INLINE},
'th': {'background': ATTR_INLINE},
'video': {'src': ATTR_INLINE, 'poster': ATTR_INLINE},
'audio': {'src': ATTR_INLINE, 'poster': ATTR_INLINE},
'source': {'src': ATTR_INLINE},
}
'''Mapping of element tag names to attributes containing links.'''
DYNAMIC_ATTRIBUTES = ('onkey', 'oncli', 'onmou')
Expand Down
5 changes: 5 additions & 0 deletions wpull/scraper/html_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,12 @@ def test_html_scraper_links(self):
'http://example.com/applet/applet_src.class',
'http://example.com/bgsound.mid',
'http://example.com/audio_src.wav',
'http://example.com/audio_poster.jpeg',
'http://example.net/source_src.wav',
'http://example.com/video_src.webm',
'http://example.com/video_poster.jpeg',
'http://example.net/track_src.vtt',
'http://example.net/source_src.webm',
'http://example.com/embed_src.mov',
'http://example.com/fig_src.png',
'http://example.com/frame_src.html',
Expand Down
6 changes: 5 additions & 1 deletion wpull/testing/samples/many_urls.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,13 @@
<area href="area_href.html">
</map>
<bgsound src="bgsound.mid">
<audio src="audio_src.wav">
<audio src="audio_src.wav" poster="audio_poster.jpeg">
<source src="http://example.net/source_src.wav">
</audio>
<video src="video_src.webm" poster="video_poster.jpeg">
<source src="http://example.net/source_src.webm">
<track default src="http://example.net/track_src.vtt">
</video>
<embed href="embed_href.html" src="embed_src.mov"></embed>
<fig src="fig_src.png"></fig>
<form action="form_action.html"></form>
Expand Down