Br browser

From XPUB & Lens-Based wiki

Br_browser detects and displays ( urls) of broken/ dead links.
I am interested in anonymous or depersonalized, transit spaces I will explore the abandoned places on the web.(start from the wiki)
Browsing through broken links - Server Internal/ External errors which eventually redirect you to no space...
"It is the vanishing point of now-here is the same time a no-where."

Top Server Errors

List of HTTP status codes
400 Bad Request
403 Forbidden
404 Not Found ---> The requested resource could not be found but may be available again in the future
500 Internal Server Error ---> A generic error message, given when no more specific message is suitable.

keywords: detect, direct, link, error, redirect



//CGI SCRIPT _ BrLinks

#!/usr/bin/env python
#-*- coding:utf-8 -*-
import cgi, urllib2, html5lib, urlparse
import cgitb; cgitb.enable()
print "Content-type: text/html;charset=utf-8"
q = cgi.FieldStorage()
url = q.getvalue("url","")
f = urllib2.urlopen(url)
ct ="content-type")
if ct.startswith("text/html"):
    t = html5lib.parse(f,treebuilder="etree",namespaceHTMLElements=False)
    for a in t.iter("a"):
    	href = a.get("href")
    	href = urlparse.urljoin(url, href)
    		page = urllib2.urlopen(href)
    	except IOError, e:
    		print '<a href="{0}">BROKEN {0}</a><br>'.format(href)