dfs
This commit is contained in:
parent
95df0fcc12
commit
f45c501a8e
3 changed files with 3 additions and 28 deletions
|
@ -490,23 +490,6 @@ def thumbnail_thread(pid):
|
|||
soup=BeautifulSoup(x.content, 'html.parser')
|
||||
#parse html
|
||||
|
||||
#first, set metadata
|
||||
try:
|
||||
meta_title=soup.find('title')
|
||||
if meta_title:
|
||||
post.submission_aux.meta_title=str(meta_title.string)[0:500]
|
||||
|
||||
meta_desc = soup.find('meta', attrs={"name":"description"})
|
||||
if meta_desc:
|
||||
post.submission_aux.meta_description=meta_desc['content'][0:1000]
|
||||
|
||||
if meta_title or meta_desc:
|
||||
db.add(post.submission_aux)
|
||||
db.commit()
|
||||
|
||||
except Exception as e:
|
||||
pass
|
||||
|
||||
#create list of urls to check
|
||||
thumb_candidate_urls=[]
|
||||
|
||||
|
@ -616,7 +599,7 @@ def submit_post(v):
|
|||
if url.startswith("https://streamable.com/") and not url.startswith("https://streamable.com/e/"):
|
||||
url = url.replace("https://streamable.com/", "https://streamable.com/e/")
|
||||
|
||||
repost = g.db.query(Submission).join(Submission.submission_aux).options(lazyload('*')).filter(
|
||||
repost = g.db.query(Submission).options(lazyload('*')).filter(
|
||||
Submission.url.ilike(url),
|
||||
Submission.deleted_utc == 0,
|
||||
Submission.is_banned == False
|
||||
|
@ -659,7 +642,7 @@ def submit_post(v):
|
|||
|
||||
body = request.values.get("body", "")
|
||||
# check for duplicate
|
||||
dup = g.db.query(Submission).join(Submission.submission_aux).options(lazyload('*')).filter(
|
||||
dup = g.db.query(Submission).options(lazyload('*')).filter(
|
||||
|
||||
Submission.author_id == v.id,
|
||||
Submission.deleted_utc == 0,
|
||||
|
@ -716,8 +699,6 @@ def submit_post(v):
|
|||
|
||||
similar_posts = g.db.query(Submission).options(
|
||||
lazyload('*')
|
||||
).join(
|
||||
Submission.submission_aux
|
||||
).filter(
|
||||
#or_(
|
||||
# and_(
|
||||
|
@ -735,8 +716,6 @@ def submit_post(v):
|
|||
if url:
|
||||
similar_urls = g.db.query(Submission).options(
|
||||
lazyload('*')
|
||||
).join(
|
||||
Submission.submission_aux
|
||||
).filter(
|
||||
#or_(
|
||||
# and_(
|
||||
|
@ -934,7 +913,6 @@ def submit_post(v):
|
|||
), 400
|
||||
|
||||
g.db.add(new_post)
|
||||
g.db.add(new_post.submission_aux)
|
||||
|
||||
g.db.flush()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue