Skip to content

Commit

Permalink
add author and author_url
Browse files Browse the repository at this point in the history
  • Loading branch information
schuellersa committed Jul 28, 2021
1 parent c31e526 commit 81d6740
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 69 deletions.
9 changes: 9 additions & 0 deletions claim_extractor/extractors/checkyourfact.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,15 @@ def extract_claim_and_review(self, parsed_claim_review_page: BeautifulSoup, url:
url_date = url.replace("https://checkyourfact.com/", "").replace("/", " ").split(" ")
claim.set_date(url_date[0] + "-" + url_date[1] + "-" + url_date[2])

# author & author_url
if parsed_claim_review_page.select('detail > article > author'):
for author in parsed_claim_review_page.select('detail > article > author'):
if (hasattr(author,"data-slug")):
author_str = author.text.split("|")[0].strip().split("\n")[0]
claim.author = author_str
claim.author_url = "https://checkyourfact.com/author/" + author['data-slug']
break

# body
body = parsed_claim_review_page.find("article")
claim.set_body(body.get_text())
Expand Down
Loading

0 comments on commit 81d6740

Please sign in to comment.