Programmatically get the number of indexed pages in Google? - c#

As an SEO metric I'd like to programmatically get the number of by Google indexed pages.
(if I search "site:mydomain.com" I want the get number of pages found).
Is there any lib for this or do I need to parse a google request?

you should use Google Webmaster Tool API.
First login in google webmaster with gmail account and familiar with the functionality then see following developer guide:
http://code.google.com/apis/webmastertools/docs/2.0/developers_guide.html

Here's something I put together that will work for a few queries per IP address per hour:
public static Int32 GooglePages(string sourceDomain)
{
String googleSource
= (new WebClient()).DownloadString(
#"http://www.google.com/search?q=site%3A" + sourceDomain);
return Convert.ToInt32(
Regex.Match(googleSource,
#"about \<b\>([0-9,]*)\<\/b\> from ")
.Groups[1].Value.Replace(",", ""));
}
If you are going to use it often, or make many queries on a regular basis I would recommend using an officially sanctioned API.

Has your site been setup in Google Analytics? If so you can use the Google Analytics API to get such information.
If you're interested in how to implement this in asp.net refer to this question.

There's probably a Google API you can use, rather than parsing the results of a search.

Related

How to get a developer key for ViaGogo API

Long shot, but I'd like to fiddle with ViaGogo API (C# library more precisely). ViaGogo has a well documented public API, documentation is avaliable here.
Problem is, you need to authenticated as it usually happens with this kind of APIs: usually, you find a section of the website, maybe in your profile section, where you can obtain keys, secrets and so on (this happens for example on Facebook or Amazon).
As for ViaGogo, I only found a link that points to a Google Form: this form asks for info about advertising and affiliation on a complete different level of what I need, I won't publish anything read via API. Furthermore, there's no field to leave an e-mail address.
Their C# library seems pretty popular as far as I can tell from downloads from NuGet; I wonder how all these thousands of devs succesfully called that API.
Has anyone succesfully obtained authentication info from ViaGogo?
According to note in registration form, you have to wait for 30 days for their reply.
For more help you can contact them on following contacts:
E-mail: affiliate#viagogo.com
Telephone: +442075532777
Or
http://www.viagogo.com/in/help
There doesn't seem to be any way around this registration according to their website and the api itself -- an appID and password is required. You may try your luck emailing them at Affiliate.Team#viagogo.com -- see this issue on github where the possibility of getting an account via email is discussed: https://github.com/viagogo/developer.viagogo.net/issues/24

What are the ways to post a tweet to twitter with asp.net c#? [duplicate]

With Twitter's new OAuth interface, their API is now many times more complex than what it was. And I haven't even looked at Facebook's API yet.
What I'm wondering if there is a method that employs some higher-level, existing code or interfaces to make this a simpler task.
All I want to be able to do is initiate a Twitter tweet or Facebook share on the user's behalf and be able to control the initial text of those messages, from an ASP.NET application.
I found some similar questions on SO, but they had no answers.
EDIT: I know there are things like AddThis and ShareThis, but I need something that will give me control over the default message. It must contain a link with a code that is specific to the current user.
Twitter Integration...
For making Tweets from an ASP.NET application on users' behalf, check out Twitterizer. It's a free, open-source project for integrating with Twitter from .NET applications.
I agree that using OAuth can be a bit daunting, but the Twitterizer API wraps up most of the complexity. I've written an article on using Twitterizer in an ASP.NET application that you may be interested in: Integrating Twitter Into An ASP.NET Website Using OAuth. After reading the article, download the code sample at the end, which is a working demo showing how to use Twitterizer to post a tweet from an ASP.NET website.
Facebook Integration...
For integrating with Facebook, chcek out the Facebook Developer Toolkit. Like Twitterizer, it's an open-source, free API and should get you going in the right direction.
Happy Programming!
After looking around for a while, I found sharethis.com. They have various share buttons you can add to your site that send Twitter tweets, Facebook shares, etc.
It looks like it also supports options to control the URL, so I could modify this to include whatever URL I need.
I haven't yet figured out if I can control the default message text. I'm looking into that.
But it seems like this is probably the simplest way to accomplish what I want.
This is probably what you're after for twitter: https://twitter.com/about/resources/buttons#tweet
Let's you configure a button (or URL to redirect to) that starts the user off with some default text. The user can change the text before they post.
Don't know about facebook.
Twitter Integration:
Check this code and link/article simple and easy :
protected void btnTweet_Click(object sender, EventArgs e)
{
string oauthAccessToken = Session["twtoken"].ToString();
string oauthAccessTokenSecret = Session["twsecret"].ToString();
OAuthHelper oauthhelper = new OAuthHelper();
oauthhelper.TweetOnBehalfOf(oauthAccessToken, oauthAccessTokenSecret, txtTweet.Text);
if (string.IsNullOrEmpty(oauthhelper.oauth_error))
Response.Write("Twit Posted Successfully");
else
Response.Write(oauthhelper.oauth_error);
}
Read more how to get access token and secret key and download OAuthHelper and OAuthUtility Class below is the link -
How to post tweet on behalf of an user from asp.net using oauth authentication
Login with twitter using oauth authentication in asp.net and get access token, screen name and userid

How to search the web with Google Search API without limit

I need a web search be my app and it would be fine to use google web search for.
This works in different cases when I do the code by myself or use assemblies like GAPI.
The problem is that I ever get an error because of paging the results:
ResponseStatus: 400, Reason: out of range start
About this problem I found this by the GAPI developer:
Google AJAX Search API does not allow more than 64 results (e.g. max page is 56).
But I need more results as this is to less for my usage I need at least 500...
Is there another way to get more result by searching the web?
It looks like GAPI is using the old Google Search API which has been officially deprecated as of November 1, 2010.
If you want more results you should look into another library or implementing your own using the Google Custom Search API:
https://developers.google.com/custom-search/v1/overview

Is there a C# API that can aid in building Google Maps links?

For example:
OpenUrl(GoogleMaps.Location("my address here"));
Would open up Google Maps and input the address as if it were typed right into the search bar on Google Maps itself.
Even better if it was able to do something like:
OpenUrl(GoogleMaps.Directions("Starting address", "End Address"));
I don't want Google Maps embedded into my application or anything fancy like that. Url generation would be perfect for my needs.
Any ideas?
May be you are looking for:
Google Maps API for .NET
For Url generation use:
Getting a static map url
Static Maps support allows you to get a valid url which you can use,
for example, with an tag.
If you are using NuGet in Visual Studio, use http://nuget.org/packages/GoogleMapsApi

How to see the URL of a source code of a website?

I have a method that searches for movies in IMDB. Problem is, I only take into account if the site returns a page with movie OPTIONS. If the site automatically finds the movie in question, my program breaks.
Is there a way for me to check the URL of source code in C#?
I think maybe you're trying to parse the page instead of using a web service to access the information. parsing a page of dynamic content is difficult, if you want them, you must create a parser capable of handling such situations you describe.
You can try these links
Imdb Services
IMDB API
AllowAutoRedirect = false;

Categories

Resources