mirror of
https://github.com/simon987/poal_feed.git
synced 2025-12-17 01:09:21 +00:00
Initial commit
This commit is contained in:
22
post_process.py
Normal file
22
post_process.py
Normal file
@@ -0,0 +1,22 @@
|
||||
from hexlib.regex import LINK_RE
|
||||
|
||||
|
||||
def post_process(item, board, helper):
|
||||
item["_v"] = 1.0
|
||||
item["_id"] = helper.item_unique_id(item)
|
||||
|
||||
if helper.item_type(item) != "user":
|
||||
item["_urls"] = helper.item_urls(item)
|
||||
if helper.item_type(item) == "comment":
|
||||
item["_sub"] = board
|
||||
|
||||
return item
|
||||
|
||||
|
||||
def get_links_from_body(body):
|
||||
result = []
|
||||
|
||||
for match in LINK_RE.finditer(body):
|
||||
url = match.group(1)
|
||||
result.append(url)
|
||||
return result
|
||||
Reference in New Issue
Block a user