internal static FB_ShareAttachment _from_graphql(JToken data) { string url = data.get("url")?.Value <string>(); FB_ShareAttachment rtn = new FB_ShareAttachment( uid: data.get("deduplication_key")?.Value <string>(), author: data.get("target")?.get("actors")?.FirstOrDefault()?.get("id")?.Value <string>(), url: url, original_url: (url?.Contains("/l.php?u=") ?? false) ? Utils.get_url_parameter(url, "u") : url, title: data.get("title_with_entities")?.get("text")?.Value <string>(), description: data.get("description")?.get("text")?.Value <string>(), source: data.get("source")?.get("text")?.Value <string>() ); rtn.attachments = data.get("subattachments")?.Select(node => FB_Attachment.graphql_to_subattachment(node))?.ToList(); JToken media = data.get("media"); if (media != null && media.get("image") != null) { JToken image = media.get("image"); rtn.image = FB_Image._from_uri(image); rtn.original_image_url = (rtn.image.url?.Contains("/safe_image.php") ?? false) ? Utils.get_url_parameter(rtn.image.url, "url") : rtn.image.url; } return(rtn); }
internal static FB_Image _from_uri_or_none(JToken data) { return((data?.get("uri") != null) ? FB_Image._from_uri(data) : null); }