-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"*" land = xx all tweets #5
Comments
Hi @MyraBaba, Also, where did you get |
I want to make a search “*” in a lang=xx
it means all tweets from that language. query = “*” . its work on the python. So we can collect lots of tweets from a language.
using the rest search api.
… On 12 Oca 2017, at 16:47, Daniela Sfregola ***@***.***> wrote:
Hi @MyraBaba <https://github.com/MyraBaba>,
I am not an expert of tweepy....can you give me more context of what you are trying to do? are you using the rest api (i.e.: searching the tweets in the past) or the streaming api (i.e.: receiving the tweets as they happen)?
Also, where did you get searchTweets...?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#5 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AQscnx9vft_0ZlB3cfxhVcNjJfXlSXd_ks5rRi7bgaJpZM4Lhw08>.
|
Hi @MyraBaba,I believe you are looking for the Cheers, |
yes I am playing with the demo code:
searchTweets("*").map { tweets =>
* is not working.
package rest
import com.danielasfregola.twitter4s.TwitterRestClient
import com.danielasfregola.twitter4s.entities.Tweet
import com.danielasfregola.twitter4s.entities.enums.{Language, ResultType}
import com.typesafe.config.ConfigFactory
import utils.FileSupport
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.Future
object SearchAndSaveTweets extends App with FileSupport {
// TODO - Make sure to define your consumer and access tokens!
val client = TwitterRestClient()
def searchTweets(query: String, max_id: Option[Long] = None): Future[Seq[Tweet]] = {
def extractNextMaxId(params: Option[String]): Option[Long] = {
//example: "?max_id=658200158442790911&q=%23scala&include_entities=1&result_type=mixed"
params.getOrElse("").split("&").find(_.contains("max_id")).map(_.split("=")(1).toLong)
}
client.searchTweet(query, count = 2, result_type = ResultType.Recent, max_id = max_id , language = Option(Language.Turkish) ).flatMap { result =>
val nextMaxId = extractNextMaxId(result.search_metadata.next_results)
val tweets = result.statuses
if (tweets.nonEmpty) searchTweets(query, nextMaxId).map(_ ++ tweets)
else Future(tweets.sortBy(_.created_at))
} recover { case _ => Seq.empty }
}
val filename = {
val config = ConfigFactory.load()
config.getString("tweets.scalax")
}
searchTweets("*").map { tweets =>
println(s"Downloaded ${tweets.size} tweets")
toFileAsJson("src/main/resources/tweets/scalax4.json", tweets)
println(s"Tweets saved to file $filename")
}
}
… On 12 Oca 2017, at 17:03, Daniela Sfregola ***@***.***> wrote:
Hi @MyraBaba <https://github.com/MyraBaba>,I believe you are looking for the searchTweet function of the TwitterRestClient. See scaladoc for more info: http://danielasfregola.github.io/twitter4s/4.0.1/api/com/danielasfregola/twitter4s/http/clients/rest/search/TwitterSearchClient <http://danielasfregola.github.io/twitter4s/4.0.1/api/com/danielasfregola/twitter4s/http/clients/rest/search/TwitterSearchClient>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#5 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AQscn7GRYqqpsbaNhfw2n4ZG_mGH5JJRks5rRjK_gaJpZM4Lhw08>.
|
|
when I put * in the query it says nothing. saved empty json file. like :
Downloaded 0 tweets
Tweets saved to file src/main/resources/tweets/scalax.json
… On 12 Oca 2017, at 17:26, Daniela Sfregola ***@***.***> wrote:
* is not working.
Do you get an error? What does it happen?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#5 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AQscn3BQrEI4f49WwnuelSiQ-D0LfZMcks5rRjgZgaJpZM4Lhw08>.
|
Hi @MyraBaba, |
thx
… On 12 Oca 2017, at 18:15, Daniela Sfregola ***@***.***> wrote:
Hi @MyraBaba <https://github.com/MyraBaba>,
it is probably a bug of the client, I'll look into it! Cheers
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#5 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AQscn5vm4Mf8FFiGyGsJcQiWttvfW79Pks5rRkOKgaJpZM4Lhw08>.
|
Hi @MyraBaba, thank you for raising this issue. Cheers, |
thanks.. I am waiting :) I want to port to scala with your twitter4s. Currently using python .
thx
… On 13 Oca 2017, at 23:25, Daniela Sfregola ***@***.***> wrote:
Hi @MyraBaba <https://github.com/MyraBaba>, thank you for raising this issue.
I have found the bug and it will be fixed in the next release (see DanielaSfregola/twitter4s#91 <DanielaSfregola/twitter4s#91> for more details).
Cheers,
D.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#5 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AQscn29QWwscbz9g2d5nqEgmEDI-DMHvks5rR928gaJpZM4Lhw08>.
|
Hi @MyraBaba, Please do let me know if this is still not working as expected. Cheers, |
Ok I will test and let you know..
… On 15 Oca 2017, at 14:24, Daniela Sfregola ***@***.***> wrote:
Hi @MyraBaba <https://github.com/MyraBaba>,
the fix has been released in twitter4s 4.1!
Please do let me know if this is still not working as expected.
Cheers,
D.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#5 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AQscnzPQ_uWGBPNrM1aN2Q7D8gkjhiRaks5rSgHRgaJpZM4Lhw08>.
|
Hi Daniela,
I tested it now with query=“*” with language=Option(Language.xxxx) all is ok now.
It is working now.
thx..
… On 15 Oca 2017, at 14:24, Daniela Sfregola ***@***.***> wrote:
Hi @MyraBaba <https://github.com/MyraBaba>,
the fix has been released in twitter4s 4.1!
Please do let me know if this is still not working as expected.
Cheers,
D.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#5 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AQscnzPQ_uWGBPNrM1aN2Q7D8gkjhiRaks5rSgHRgaJpZM4Lhw08>.
|
Hi,
in python api we can do 👍
resp = t.search.tweets(q="*", lang=langs[language], count=page_size, last_id=last_id, until=start_date, blah=str(uuid.uuid4()))
q="*" we can use.
But when we try in demo code:
searchTweets("*").map { tweets => println(s"Downloaded ${tweets.size} tweets") toFileAsJson("src/main/resources/tweets/scalax3.json", tweets) println(s"Tweets saved to file $filename") }
its not working ..
any idea.?
The text was updated successfully, but these errors were encountered: