Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Grabbing Website Title is too slow

$
0
0

Hi,

I am using below code to grab website title and I also want later to grab the website photo(s) just like what Fcebook, linkedin and twitter is doing

The problem I facing here that it is too slow and takes very long time to show the title unlike when you do it using facebook or linkedin for example

How can I fix that please?

private async void Button_Clicked(object sender, EventArgs e)
{
    LabelWebsiteURL.Text = EntryURL.Text;

    HttpClient hc = new HttpClient();
    HttpResponseMessage response = await hc.GetAsync(new Uri(LabelWebsiteURL.Text, UriKind.Absolute));
    string source = await response.Content.ReadAsStringAsync();

    string title = Regex.Match(source, @"\<title\b[^>]*\>\s*(?<Title>[\s\S]*?)\</title\>", RegexOptions.IgnoreCase).Groups["Title"].Value;

    LabelWebsiteTitle.Text = title;
}

Thanks,
Jassim


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>