@@ -35,7 +35,7 @@ defmodule Algora.Crawler do
3535 og_description: find_description ( html_tree ) ,
3636 og_image_url: find_og_image ( html_tree ) ,
3737 favicon_url: find_logo ( html_tree , url ) ,
38- socials: find_social_links ( html_tree )
38+ socials: find_social_links ( html_tree , url )
3939 }
4040
4141 # Enhance metadata with GitHub info if available
@@ -266,17 +266,17 @@ defmodule Algora.Crawler do
266266 |> Enum . join ( " " )
267267 end
268268
269- defp find_social_links ( html_tree ) do
269+ defp find_social_links ( html_tree , url ) do
270270 % {
271- twitter: find_social_url ( html_tree , :twitter ) ,
272- discord: find_social_url ( html_tree , :discord ) ,
273- github: find_social_url ( html_tree , :github ) ,
274- instagram: find_social_url ( html_tree , :instagram ) ,
275- youtube: find_social_url ( html_tree , :youtube ) ,
276- producthunt: find_social_url ( html_tree , :producthunt ) ,
277- hackernews: find_social_url ( html_tree , :hackernews ) ,
278- slack: find_social_url ( html_tree , :slack ) ,
279- linkedin: find_social_url ( html_tree , :linkedin )
271+ twitter: find_social_url ( html_tree , :twitter , url ) ,
272+ discord: find_social_url ( html_tree , :discord , url ) ,
273+ github: find_social_url ( html_tree , :github , url ) ,
274+ instagram: find_social_url ( html_tree , :instagram , url ) ,
275+ youtube: find_social_url ( html_tree , :youtube , url ) ,
276+ producthunt: find_social_url ( html_tree , :producthunt , url ) ,
277+ hackernews: find_social_url ( html_tree , :hackernews , url ) ,
278+ slack: find_social_url ( html_tree , :slack , url ) ,
279+ linkedin: find_social_url ( html_tree , :linkedin , url )
280280 }
281281 |> Enum . reject ( fn { _k , v } -> is_nil ( v ) end )
282282 |> Map . new ( )
@@ -332,7 +332,7 @@ defmodule Algora.Crawler do
332332 ]
333333 }
334334
335- defp find_social_url ( html_tree , platform ) do
335+ defp find_social_url ( html_tree , platform , base_url ) do
336336 selectors = @ social_selectors [ platform ]
337337
338338 Enum . find_value ( selectors , fn selector ->
@@ -349,7 +349,7 @@ defmodule Algora.Crawler do
349349
350350 case url do
351351 nil -> nil
352- url -> follow_redirect ( url )
352+ url -> follow_redirect ( make_absolute_url ( url , base_url ) )
353353 end
354354 end )
355355 end
0 commit comments