
__all__ = ["parse"]

from jasy.env.State import session
from jasy.core import Console
from bs4 import BeautifulSoup


def parse(filename):
	""" HTML parser class for Konstrukteur """
	page = {}

	parsedContent = BeautifulSoup(open(filename, "rt").read())
	page["content"] = "".join([str(tag) for tag in parsedContent.find("body").contents]) 
	page["title"] = parsedContent.title.string

	for meta in parsedContent.find_all("meta"):
		page[meta["name"].lower()] = meta["contents"]

	return page

__all__ = ["parse"]

from jasy.env.State import session
from jasy.core import Console
from bs4 import BeautifulSoup


def parse(filename):
	""" HTML parser class for Konstrukteur """
	page = {}

	parsedContent = BeautifulSoup(open(filename, "rt").read())

	body = parsedContent.find("body")

	page["content"] = "".join([str(tag) for tag in body.contents])
	page["title"] = parsedContent.title.string

	page["summary"] = body.p.get_text()

	for meta in parsedContent.find_all("meta"):
		page[meta["name"].lower()] = meta["contents"]

	return page
Add summary to html parser
Add summary to html parser

  
  __all__ = ["parse"]
  
  from jasy.env.State import session
  from jasy.core import Console
  from bs4 import BeautifulSoup
  
  
  def parse(filename):
  	""" HTML parser class for Konstrukteur """
  	page = {}
  
  	parsedContent = BeautifulSoup(open(filename, "rt").read())
+ 
+ 	body = parsedContent.find("body")
+ 
- 	page["content"] = "".join([str(tag) for tag in parsedContent.find("body").contents]) 
+ 	page["content"] = "".join([str(tag) for tag in body.contents])
  	page["title"] = parsedContent.title.string
+ 
+ 	page["summary"] = body.p.get_text()
  
  	for meta in parsedContent.find_all("meta"):
  		page[meta["name"].lower()] = meta["contents"]
  
  	return page
Add summary to html parser
## Code Before:

__all__ = ["parse"]

from jasy.env.State import session
from jasy.core import Console
from bs4 import BeautifulSoup


def parse(filename):
	""" HTML parser class for Konstrukteur """
	page = {}

	parsedContent = BeautifulSoup(open(filename, "rt").read())
	page["content"] = "".join([str(tag) for tag in parsedContent.find("body").contents]) 
	page["title"] = parsedContent.title.string

	for meta in parsedContent.find_all("meta"):
		page[meta["name"].lower()] = meta["contents"]

	return page
## Instruction:
Add summary to html parser
## Code After:

__all__ = ["parse"]

from jasy.env.State import session
from jasy.core import Console
from bs4 import BeautifulSoup


def parse(filename):
	""" HTML parser class for Konstrukteur """
	page = {}

	parsedContent = BeautifulSoup(open(filename, "rt").read())

	body = parsedContent.find("body")

	page["content"] = "".join([str(tag) for tag in body.contents])
	page["title"] = parsedContent.title.string

	page["summary"] = body.p.get_text()

	for meta in parsedContent.find_all("meta"):
		page[meta["name"].lower()] = meta["contents"]

	return page