i adapted following code 1 found online. works ok not running continuously , pulling in new tweets. need change? appreciated.
private static void stream_filteredstreamexample() { sqlconnection conn = new sqlconnection(@"data source=********************"); conn.open(); (; ; ) { try { var stream = stream.createfilteredstream(); //stream.addlocation(geo.generatelocation(-180, -90, 180, 90)); stream.addtweetlanguagefilter(language.english); stream.addtrack("#tubestrike"); var timer = stopwatch.startnew(); stream.matchingtweetreceived += (sender, args) => { var tweet = args.tweet; if (timer.elapsedmilliseconds > 1000) { console.writeline("{0}, {1}", tweet.idstr, tweet.text); timer.restart(); } }; stream.startstreammatchingallconditions(); } catch (exception ex) { console.writeline("exception: {0}", ex.message); } } }
you want use following code:
stream.streamstopped += (sender, args) => { stream.startstreammatchingallconditions(); };
Comments
Post a Comment