How to search twitter.com/search and parse the data in android -
i have been dealing twitter application in android. used oauth authentication , did search given keyword.
the problem rate limit. can't perform many searches.
well after exhaust search came across link:using search api
it says that:
as users, best thing perform search twitter.com/search
then found application in google play twitter search doesn't use authentication , performs unlimited searches.
i doubt twitter search
developer has used logic.
- would possible make search directly
twitter.com/search
? - if yes, libraries/methods/ways should follow?
would possible make search directly twitter.com/search ?
technically yes, should avoided if @ possible. have parse html , both slow , error prone process.
what libraries/methods/ways should follow?
you should stick official api. realise rate limit kind of in way, confident can mitigate problem reducing overall amount of calls api , more efficiently using each call. have remember official twitter api. twitter wants twitter apps , awesome , while rate limit of 100 calls per hour seems pretty low should more enough. should rate limit reached anyway need proper error handling. know fact third party twitter apps kind of freeze content when reaching rate limit. error displayed inform user cannot update anymore hour, can still continue using app before cached data previous calls.
since haven't posted code not sure else tell try smart each call. use cached data as possible , perform api calls when absolutely necessary.
edit: think parsing data https://mobile.twitter.com/search best in case. div class timeline
. every <table />
in div contains 1 tweet. shouldn't difficult parse.
i tested using htmlcleaner:
htmlcleaner cleaner = new htmlcleaner(); tagnode root = cleaner.clean("https://mobile.twitter.com/search?q=asdf"); ... // filter out div class "timeline" list<? extends tagnode> tweets = timelinediv.getelementlistbyattvalue("class", "tweet", false, true);
Comments
Post a Comment