Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
La Quadrature du Net
rpteam
Revue de Press
Commits
d8089cd1
Commit
d8089cd1
authored
Apr 02, 2019
by
Okhin
Browse files
Adding an opengrap parser on Article.add_new_url
parent
ab0c8db4
Pipeline
#2533
failed with stages
in 31 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
apps/rp/models.py
View file @
d8089cd1
...
...
@@ -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
...
...
requirements.txt
View file @
d8089cd1
...
...
@@ -15,4 +15,5 @@ url
coreapi
pygments
markdown
opengraph
-e git+https://github.com/mariocesar/sorl-thumbnail.git#egg=sorl-thumbnail
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment