bizarticle

This commit is contained in:
Andreas Stephanides
2017-01-15 08:05:40 +01:00
parent 3e3b6699cf
commit 449a278d58
2 changed files with 26 additions and 2 deletions

View File

@@ -135,6 +135,30 @@ def fsarcharticle(url, raw):
d["author"]=None
return {"article": d}
def fsbizarticle(url, raw):
sp=BeautifulSoup(raw)
d={}
h=sp.find("h1", {"class": "entry-title"})
if h is not None:
d["title"]=h.text.strip()
d["url"]=url
h=sp.find("time", {"class": "entry-date"})
if h is not None:
d["published"] = parse(h.attrs["datetime"])
else:
d["published"]=None
h=sp.find("div", {"class": "entry-content"})
if h is not None:
d["text"]=h.encode_contents().strip()
d["image"]=""
d["sourcetype"]="fsbizarticle"
d["section"]="fsbiz"
h=sp.find("span", {"class": "author"})
d["author"]=None
if h is not None:
d["author"]=h.find("a").text.strip()
return {"article": d}
def fetindex(url, raw):
if raw is None:
raise Error