From e72074f78a902d34fc50ef71f615ae45af6e3c9f Mon Sep 17 00:00:00 2001 From: Harrison Chase Date: Tue, 14 Mar 2023 21:17:50 -0700 Subject: [PATCH] Harrison/ifixit (#1680) Co-authored-by: David Rans --- langchain/document_loaders/ifixit.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/langchain/document_loaders/ifixit.py b/langchain/document_loaders/ifixit.py index 18b6c797..61169ade 100644 --- a/langchain/document_loaders/ifixit.py +++ b/langchain/document_loaders/ifixit.py @@ -99,7 +99,10 @@ class IFixitLoader(BaseLoader): 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")