add extra post & user info
This commit is contained in:
parent
71a4f8c5a4
commit
5bcb6e8884
@ -65,7 +65,9 @@ def scrape_thread (url):
|
|||||||
# returns the rest of the thread's contents instead of just that post.
|
# returns the rest of the thread's contents instead of just that post.
|
||||||
# So we need to pick out only the first (username/signature/postbody)
|
# So we need to pick out only the first (username/signature/postbody)
|
||||||
# to get around this.
|
# to get around this.
|
||||||
|
date_element = post_entry.find(".date").eq(0)
|
||||||
post_content_container = post_entry.find(".post-content-container").eq(0)
|
post_content_container = post_entry.find(".post-content-container").eq(0)
|
||||||
|
user_header = post_entry.find("header").eq(0)
|
||||||
signature = post_content_container.find(".signature").eq(0)
|
signature = post_content_container.find(".signature").eq(0)
|
||||||
post_content_container.remove(".signature")
|
post_content_container.remove(".signature")
|
||||||
|
|
||||||
@ -75,7 +77,14 @@ def scrape_thread (url):
|
|||||||
signature = None
|
signature = None
|
||||||
|
|
||||||
thread.children.append(Post(
|
thread.children.append(Post(
|
||||||
author=User(name=post_entry.find("header > p > a").eq(0).text(), signature=signature),
|
author=User(
|
||||||
|
name=user_header.find("p > a").eq(0).text(),
|
||||||
|
avatar=user_header.find("img[alt='avatar']").attr.src,
|
||||||
|
title=user_header.find(".auto-title").text(),
|
||||||
|
subtitle=user_header.find(".custom_title").text(),
|
||||||
|
signature=signature
|
||||||
|
),
|
||||||
|
timestamp=date_element.text(),
|
||||||
body=post_content_container.html().strip()
|
body=post_content_container.html().strip()
|
||||||
))
|
))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user