Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
pleroma
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mfc
pleroma
Commits
b4cf74c1
Commit
b4cf74c1
authored
5 years ago
by
Maksim
Browse files
Options
Downloads
Patches
Plain Diff
added prepare html for RichMedia.Parser
parent
9c64a257
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
lib/pleroma/web/rich_media/parser.ex
+5
-1
5 additions, 1 deletion
lib/pleroma/web/rich_media/parser.ex
mix.exs
+1
-1
1 addition, 1 deletion
mix.exs
mix.lock
+1
-1
1 addition, 1 deletion
mix.lock
with
7 additions
and
3 deletions
lib/pleroma/web/rich_media/parser.ex
+
5
−
1
View file @
b4cf74c1
...
...
@@ -81,6 +81,7 @@ defp parse_url(url) do
{
:ok
,
%
Tesla
.
Env
{
body:
html
}}
=
Pleroma
.
HTTP
.
get
(
url
,
[],
adapter:
@hackney_options
)
html
|>
parse_html
|>
maybe_parse
()
|>
Map
.
put
(
:url
,
url
)
|>
clean_parsed_data
()
...
...
@@ -91,6 +92,8 @@ defp parse_url(url) do
end
end
defp
parse_html
(
html
),
do
:
Floki
.
parse
(
html
)
defp
maybe_parse
(
html
)
do
Enum
.
reduce_while
(
parsers
(),
%{},
fn
parser
,
acc
->
case
parser
.
parse
(
html
,
acc
)
do
...
...
@@ -100,7 +103,8 @@ defp maybe_parse(html) do
end
)
end
defp
check_parsed_data
(%{
title:
title
}
=
data
)
when
is_binary
(
title
)
and
byte_size
(
title
)
>
0
do
defp
check_parsed_data
(%{
title:
title
}
=
data
)
when
is_binary
(
title
)
and
byte_size
(
title
)
>
0
do
{
:ok
,
data
}
end
...
...
This diff is collapsed.
Click to expand it.
mix.exs
+
1
−
1
View file @
b4cf74c1
...
...
@@ -131,7 +131,7 @@ defp deps do
{
:phoenix_swoosh
,
"~> 0.2"
},
{
:gen_smtp
,
"~> 0.13"
},
{
:websocket_client
,
git:
"https://github.com/jeremyong/websocket_client.git"
,
only:
:test
},
{
:floki
,
"~> 0.2
0
.0"
},
{
:floki
,
"~> 0.2
3
.0"
},
{
:ex_syslogger
,
github:
"slashmili/ex_syslogger"
,
tag:
"1.4.0"
},
{
:timex
,
"~> 3.5"
},
{
:ueberauth
,
"~> 0.4"
},
...
...
This diff is collapsed.
Click to expand it.
mix.lock
+
1
−
1
View file @
b4cf74c1
...
...
@@ -34,7 +34,7 @@
"ex_rated": {:hex, :ex_rated, "1.3.3", "30ecbdabe91f7eaa9d37fa4e81c85ba420f371babeb9d1910adbcd79ec798d27", [:mix], [{:ex2ms, "~> 1.5", [hex: :ex2ms, repo: "hexpm", optional: false]}], "hexpm"},
"ex_syslogger": {:git, "https://github.com/slashmili/ex_syslogger.git", "f3963399047af17e038897c69e20d552e6899e1d", [tag: "1.4.0"]},
"excoveralls": {:hex, :excoveralls, "0.11.1", "dd677fbdd49114fdbdbf445540ec735808250d56b011077798316505064edb2c", [:mix], [{:hackney, "~> 1.0", [hex: :hackney, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm"},
"floki": {:hex, :floki, "0.2
0.4
", "
be42ac911fece24b4c72f3b5846774b6e61b83fe685c2fc9d62093277fb3bc86", [:mix], [{:html_entities, "~> 0.4.0", [hex: :html_entities, repo: "hexpm", optional: false]}, {:mochiweb, "~> 2.15", [hex: :mochiweb
, repo: "hexpm", optional: false]}], "hexpm"},
"floki": {:hex, :floki, "0.2
3.0
", "
956ab6dba828c96e732454809fb0bd8d43ce0979b75f34de6322e73d4c917829", [:mix], [{:html_entities, "~> 0.4.0", [hex: :html_entities
, repo: "hexpm", optional: false]}], "hexpm"},
"gen_smtp": {:hex, :gen_smtp, "0.14.0", "39846a03522456077c6429b4badfd1d55e5e7d0fdfb65e935b7c5e38549d9202", [:rebar3], [], "hexpm"},
"gettext": {:hex, :gettext, "0.17.0", "abe21542c831887a2b16f4c94556db9c421ab301aee417b7c4fbde7fbdbe01ec", [:mix], [], "hexpm"},
"hackney": {:hex, :hackney, "1.15.1", "9f8f471c844b8ce395f7b6d8398139e26ddca9ebc171a8b91342ee15a19963f4", [:rebar3], [{:certifi, "2.5.1", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "6.0.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "1.0.1", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "~>1.1", [hex: :mimerl, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "1.1.4", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}], "hexpm"},
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment