HowTo: make out Retweet-counter in a random URL

 

Twitter offers some interesting functions with the integration of the twitter button – every user can see how often the website has been retweeted and he can do the same with just one click. But of course the whole thing has his price:

- The integration of the Twitter JavaScript makes the whole data protection process difficult

- You’ll need the Twitter JavaScript

- “background” processes are not able to access the “Tweet” numbers

 

Twitters rocky way across the official API

It seems like a frequently asked question in the Twitter development board: How can I access the information in the Twitter button? Officially Twitter appreciates the usage of the streaming API. Here is an example. But this API is only accessible with an authenticated Dev-Account. If you own many sites the numerous restrictions of Twitter might be a problem for you.

 

The easy way using http://urls.api.twitter.com/1/urls/count.json?url=…

Well it is not difficult to make out where the magic button gets his information’s from. Even if Twitter never tires to point out that this is not an official API the usage is quite easy:

GET Request: http://urls.api.twitter.com/1/urls/count.json?url=http://blog.codeinside.eu/2014/04/15/source-code-verffentlichen-aber-bitte-mit-lizenz/

Result:

{"count":7,"url":"http:\/\/blog.codeinside.eu\/2014\/04\/15\/source-code-verffentlichen-aber-bitte-mit-lizenz\/"}

 

Via Code:

class Program 2: { 3: static void Main(string[] args) 4: { 5: string url = "http://urls.api.twitter.com/1/urls/count.json?url=http://blog.codeinside.eu/2014/04/26/fix-excel-com-exception-code-2147467259-exception-from-hresult-0x80028018/#comments"; 6: 7: // Be carefull with this code - use async/await - 8: // pure demo code inside a console application 9: 10: var client = new HttpClient(); 11: var result = client.GetAsync(url).Result; 12: 13: Console.WriteLine(result.Content.ReadAsStringAsync().Result); 14: Console.ReadLine(); 15: } 16: }

 

The code is also available on GitHub.

P.S.: Golem is using a similar code. It seems like it is working for big projects as well.

Read more

Time-controlled Azure WebJobs – Azure as easy as it get‘s

    While still in development the Azure WebJob SDK offers some cool features for procession and supply of information. A good example is the sample that observes the Azure Queue and processes an item as soon as it spots one.   Scenario: time-controlled activities – without queue and so on My scenario was quite […]

Read more

HowTo: Create RSS Feeds with ASP.NET MVC

image2021-570x194_thumb.png

I’ve already written about how to consume RSS or Atom Feeds with the SyndicationFeed (in German, sry) but todays post is about how to create or publish an own feed. Beside the age of the feed standard and the much defamation from Facebook, Twitter and Google on RSS/Atom I consider this easy to consume API […]

Read more

How to access an Azure Website with the local IIS Manager

image1997-311x194_thumb.png

Since the end of February it is possible to access an Azure Website with the IIS Manager. Although the Azure Management site offers some information there are more details visible at the IIS Manager. For the connection you will need an IIS Manager and the IIS Manager for Remote Administration Extension. It’s also possible to […]

Read more

Create and validate own Json-Web-Tokens (JWTs)

image1929-570x143_thumb.png

If you are interested in web authentication you probably have heard about JSON Web tokens (JWT). What is a JWT? Maybe I’m not using the correct security termination but however: JWTs are used to exchange claims between two systems. For example: You want to log on to a service (like Facebook, Twitter, etc.) and want […]

Read more

Micro-Optimization: how to shrink or „embed“ pictures

  I’m currently working on the “CodeInside Dashboard” and since the page structure isn’t that difficult it should be possible to fulfill all of Google Pagespeed or Yahoos YSlow recommendations. One of the rules was to optimize the 4 PNGs that are embedded on the page.   Before – without optimization: Below you can see […]

Read more

Move to Windows Azure – VMs, Word Press Migration, DNS changes

image1979-570x194.png

Since mid January this blogs runs on a WordPress installation in an Azure VM. Because I always thought that the subject is quite complicated this blogpost offers a view behind the scenes. Why this move? So far this blog (both German and English Version) runs on a hoster somewhere in Germany. The main problem with this […]

Read more

Windows Azure Active Directory – CRUD for users and groups

  Windows Azure Active Directory? If you are not informed about the subject I recommend you to have a look on this Azure Info site. Which resources are there? The Azure AD contains the following entities: – Users – Groups – Contacts – Roles Access to the directory or on the “directory graph” Although the […]

Read more

Introduction into SignalR 2.0 & Azure Website Websockets

  SignalR is an Open Source Framework for Real Time WebApps. The main problem with Real-Time in the web is the canal between Browser and Server. If you never had to deal with SignalR and this problem before here is a brief introduction:   The problem Traditionally the browser initiates the request to the server […]

Read more

ESENT – the „ancient NoSQL DB“ made by Windows

  Those of you who use RavenDB might have heard about ESENT already. In the inside RavenDB uses the “Extensible Storage Engine” which is included into Windows since XP. Read here why Ayende is looking for an alternative for a while – although ESENT is basically reliable but that’s just a side note. ESENT is […]

Read more

Recent Posts

  • HowTo: make out Retweet-counter in a random URL

      Twitter offers some interesting functions with the integration of the twitter button – every user can see how often the website has been retweeted and he can do the same with just one click. But of course the whole thing has his price: - The integration of the Twitter JavaScript makes the whole data […]

  • Time-controlled Azure WebJobs – Azure as easy as it get‘s

        While still in development the Azure WebJob SDK offers some cool features for procession and supply of information. A good example is the sample that observes the Azure Queue and processes an item as soon as it spots one.   Scenario: time-controlled activities – without queue and so on My scenario was quite […]

  • image2021-570x194_thumb.png
    HowTo: Create RSS Feeds with ASP.NET MVC

    I’ve already written about how to consume RSS or Atom Feeds with the SyndicationFeed (in German, sry) but todays post is about how to create or publish an own feed. Beside the age of the feed standard and the much defamation from Facebook, Twitter and Google on RSS/Atom I consider this easy to consume API […]

  • image1997-311x194_thumb.png
    How to access an Azure Website with the local IIS Manager

    Since the end of February it is possible to access an Azure Website with the IIS Manager. Although the Azure Management site offers some information there are more details visible at the IIS Manager. For the connection you will need an IIS Manager and the IIS Manager for Remote Administration Extension. It’s also possible to […]

  • image1929-570x143_thumb.png
    Create and validate own Json-Web-Tokens (JWTs)

    If you are interested in web authentication you probably have heard about JSON Web tokens (JWT). What is a JWT? Maybe I’m not using the correct security termination but however: JWTs are used to exchange claims between two systems. For example: You want to log on to a service (like Facebook, Twitter, etc.) and want […]

Support us