Quantcast
Channel: bugs, errors - openFrameworks
Viewing all articles
Browse latest Browse all 636

ofxTwitter archive and live search

$
0
0

@RICARDO_GRACA wrote:

I’m working on this project which I am trying to get both live tweets and “archived/old” tweets using the ofxTwitter API. I can search for live tweets easily using client.search(string) and I can also search old tweets using:

ofxTwitter::SearchQuery query(string)
query.setCount(50);
client.search(query)

My problem is that after doing a search query for older tweets I can’t search for live feed again, it gets stuck on the client.search(string) part.
I’ll now show some of the code that would help solve the problem.

This is my searchTweet function.

void ofApp::searchTweet(bool archive, string text)
{
	cout << "Searching..." << endl;
	if (archive)
	{
		ofxTwitter::SearchQuery query(text);
		query.setCount(50);
		client.search(query);
	}
	else
	{
		cout << "done";
		client.search(text);
		cout << " dOnE ";
	}
	cout << "DONE" << endl;
}

This is where I call for my live tweets

if (ofGetElapsedTimeMillis() >= updateTweetWordSearch)
		{
			updateTweetWordSearch += 6000;
			cout << "get tweets live" << endl;
			searchTweet(false, myTweetWords[updateTweetWordSearchCount]);
			if (updateTweetWordSearchCount < myTweetWords.size() - 1)
			{
				updateTweetWordSearchCount++;
			}
			else
			{
				updateTweetWordSearchCount = 0;
			}
		}

This is where I call for my “archive/old” tweets

if (searchBar.inside(xMouseClick, yMouseClick))
	{
		changeTextBoxColour = true;
		userCanType = true;
	}
	else if (searchButton.inside(xMouseClick, yMouseClick))
	{
		changeTextBoxColour = false;
		userCanType = false;
		if (userInput != "")
		{
			count = 0;
			cout << "get tweets archive" << endl;
			searchTweet(true, userInput);
			myTweets.clear();
			userInput = "";
		}
	}

Any help would be appreciated. @bakercp

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 636

Trending Articles