> I need to retreive all the tweets in a time range (say for last seven
> days), irrespective of the user who made them.

That's going to be a LOT of tweets. Our site http://stltweets.com
follows just St. Louis located people, mentions and 1500+ curated
users.  We get >60000 unique tweets every day... and that's a tiny
little slice of all tweets...

> Also,I want to store them in database so that I can use them later.How can I 
> do this
> in .net .

There are many strategies... and several libraries. I personally use
the LinqToTwitter library from CodePlex to do the Twitter side of
things, and use a SQL Server 2008 database via simple DataReader
stuff.  The thing is,there is no way you can do this with the firehose
(which is the only way you will get "all tweets"), because no database
is going to commit that fast.  I don't have any issues keeping up with
my stream, but you're talking about a ton more data.

In any case, it can be done quite easily in .Net... start with
http://linqtotwitter.codeplex.com and a simple schema to capture the
data.  You'll have to figure out how you are going to use the data to
properly design a schema, but for simple use something like this:

SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[Tweep](
        [UserID] [bigint] NOT NULL,
        [ScreenName] [nvarchar](20) NOT NULL,
        [Name] [nvarchar](30) NOT NULL,
        [Location] [nvarchar](30) NOT NULL,
        [Description] [nvarchar](160) NOT NULL,
        [ProfileImageUrl] [nvarchar](max) NOT NULL,
        [HomepageUrl] [nvarchar](max) NOT NULL,
        [Followers] [int] NOT NULL,
        [Following] [int] NOT NULL,
        [Listed] [int] NOT NULL,
        [Tweets] [bigint] NOT NULL,
        [Freshness] [datetime] NOT NULL,
        [Verified] [bit] NOT NULL,
 CONSTRAINT [PK_Tweep] PRIMARY KEY CLUSTERED
(
        [UserID] ASC
)
GO

CREATE UNIQUE NONCLUSTERED INDEX [IX_Tweep_ScreenName] ON [dbo].
[Tweep]
(
        [ScreenName] ASC
)
GO

CREATE TABLE [dbo].[Tweet](
        [TweetID] [bigint] NOT NULL,
        [TweepUserID] [bigint] NOT NULL,
        [CreatedTime] [datetime] NOT NULL,
        [Message] [nvarchar](max) NOT NULL,
        [Source] [nchar](100) NOT NULL,
 CONSTRAINT [PK_Tweet] PRIMARY KEY CLUSTERED
(
        [TweetID] ASC
)
GO

ALTER TABLE [dbo].[Tweet]  WITH CHECK ADD  CONSTRAINT [FK_Tweet_Tweep]
FOREIGN KEY([TweepUserID])
REFERENCES [dbo].[Tweep] ([UserID])
GO

ALTER TABLE [dbo].[Tweet] CHECK CONSTRAINT [FK_Tweet_Tweep]
GO

Hope this gets you started...

Reply via email to