MCPcopy Index your code
hub / github.com/pyload/pyload / _RelativeURIResolver

Class _RelativeURIResolver

module/lib/feedparser.py:2423–2462  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2421 return {"tags": p.tags, "enclosures": p.enclosures, "xfn": p.xfn, "vcard": p.vcard}
2422
2423class _RelativeURIResolver(_BaseHTMLProcessor):
2424 relative_uris = [('a', 'href'),
2425 ('applet', 'codebase'),
2426 ('area', 'href'),
2427 ('blockquote', 'cite'),
2428 ('body', 'background'),
2429 ('del', 'cite'),
2430 ('form', 'action'),
2431 ('frame', 'longdesc'),
2432 ('frame', 'src'),
2433 ('iframe', 'longdesc'),
2434 ('iframe', 'src'),
2435 ('head', 'profile'),
2436 ('img', 'longdesc'),
2437 ('img', 'src'),
2438 ('img', 'usemap'),
2439 ('input', 'src'),
2440 ('input', 'usemap'),
2441 ('ins', 'cite'),
2442 ('link', 'href'),
2443 ('object', 'classid'),
2444 ('object', 'codebase'),
2445 ('object', 'data'),
2446 ('object', 'usemap'),
2447 ('q', 'cite'),
2448 ('script', 'src')]
2449
2450 def __init__(self, baseuri, encoding, _type):
2451 _BaseHTMLProcessor.__init__(self, encoding, _type)
2452 self.baseuri = baseuri
2453
2454 def resolveURI(self, uri):
2455 return _makeSafeAbsoluteURI(_urljoin(self.baseuri, uri.strip()))
2456
2457 def unknown_starttag(self, tag, attrs):
2458 if _debug:
2459 sys.stderr.write('tag: [%s] with attributes: [%s]\n' % (tag, str(attrs)))
2460 attrs = self.normalize_attrs(attrs)
2461 attrs = [(key, ((tag, key) in self.relative_uris) and self.resolveURI(value) or value) for key, value in attrs]
2462 _BaseHTMLProcessor.unknown_starttag(self, tag, attrs)
2463
2464def _resolveRelativeURIs(htmlSource, baseURI, encoding, _type):
2465 if _debug:

Callers 1

_resolveRelativeURIsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected