def get_webpage_as_object(self, url): try: html, status = self.get_html(url) if html and status == 200: tokeniser = Tokens() tokens = tokeniser.tokenise(html) objectifier = HTMLObject() objectifier.tokens_to_html_object(tokens, url) return objectifier else: return Website() except: return Website()
def test_tokens_to_html_object_with_body_html(self): t = Tokens() tokens = t.tokenise(html) ho = HTMLObject() ho.tokens_to_html_object(tokens) print("done")
def test_get_string_content(self): t = Tokens() h = "<head>stuff</head>" tag = t.get_string_content(h, 5) print("") self.assertEqual(("stuff", 6,), tag)
def test_get_tag(self): t = Tokens() h = "hello<head>stuff</head>" tag = t.get_tag(h, 5) print("")
def test_tokenise(self): t = Tokens() tokens = t.tokenise(hhh) #tokens = t.tokenise(self.html) print("done")