Commit d8089cd1 authored by okhin's avatar okhin 🚴

Adding an opengrap parser on Article.add_new_url

parent ab0c8db4
Pipeline #2533 failed with stages
in 31 seconds
......@@ -6,6 +6,7 @@ from taggit.managers import TaggableManager
from newspaper import Article as ArticleParser
from django_und.models import VoteMixin
from django_fsm import FSMField, transition, RETURN_VALUE
import opengraph as og
from io import BytesIO
from datetime import datetime
......@@ -183,6 +184,8 @@ class Article(VoteMixin):
if by is not None:
article.upvote(by)
# Let's get metadata import
article.metadata = og.OpenGraph(url=url)
article.save()
return article
......
......@@ -15,4 +15,5 @@ url
coreapi
pygments
markdown
opengraph
-e git+https://github.com/mariocesar/sorl-thumbnail.git#egg=sorl-thumbnail
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment