From 3e8dd702c65c8b374e30b41f9886466325dae671 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Thomas?= Date: Thu, 23 Feb 2017 21:27:04 +0100 Subject: Extract target url from fbrpc:// URLs Those URLs seem to be generated when the Android share feature is used. Fixes #97 --- facebook/facebook-api.c | 6 +++++- facebook/facebook-api.h | 7 +++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/facebook/facebook-api.c b/facebook/facebook-api.c index 0e7d3a3..d9d4486 100644 --- a/facebook/facebook-api.c +++ b/facebook/facebook-api.c @@ -1353,7 +1353,11 @@ fb_api_xma_parse(FbApi *api, const gchar *body, JsonNode *root, GError **error) if (g_strcmp0(str, "ExternalUrl") == 0) { prms = fb_http_values_new(); fb_http_values_parse(prms, url, TRUE); - text = fb_http_values_dup_str(prms, "u", NULL); + if (g_str_has_prefix(url, FB_API_FBRPC_PREFIX)) { + text = fb_http_values_dup_str(prms, "target_url", NULL); + } else { + text = fb_http_values_dup_str(prms, "u", NULL); + } fb_http_values_free(prms); } else { text = g_strdup(url); diff --git a/facebook/facebook-api.h b/facebook/facebook-api.h index cb7467f..b6a2812 100644 --- a/facebook/facebook-api.h +++ b/facebook/facebook-api.h @@ -67,6 +67,13 @@ */ #define FB_API_WHOST "https://www.facebook.com" +/** + * FB_API_FBRPC_PREFIX + * + * The fbrpc URL prefix used in links shared from the mobile app. + */ +#define FB_API_FBRPC_PREFIX "fbrpc://facebook/nativethirdparty" + /** * FB_API_KEY: * -- cgit v1.2.3