Skip to content

Commit

Permalink
Harrison/ifixit (langchain-ai#1680)
Browse files Browse the repository at this point in the history
Co-authored-by: David Rans <[email protected]>
  • Loading branch information
hwchase17 and davidrans authored Mar 15, 2023
1 parent 0b29e68 commit e72074f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion langchain/document_loaders/ifixit.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,10 @@ def load_questions_and_answers(
output.append("# " + title)
output.append(soup.select_one(".post-content .post-text").text.strip())

output.append("\n## " + soup.find("div", "post-answers-header").text.strip())
answersHeader = soup.find("div", "post-answers-header")
if answersHeader:
output.append("\n## " + answersHeader.text.strip())

for answer in soup.select(".js-answers-list .post.post-answer"):
if answer.has_attr("itemprop") and "acceptedAnswer" in answer["itemprop"]:
output.append("\n### Accepted Answer")
Expand Down

0 comments on commit e72074f

Please sign in to comment.