Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/api/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
无法使用clojure twitter api twttr搜索推文_Api_Twitter_Clojure - Fatal编程技术网

无法使用clojure twitter api twttr搜索推文

无法使用clojure twitter api twttr搜索推文,api,twitter,clojure,Api,Twitter,Clojure,使用twttr和其他Clojure twitter api库,我在发送推文或更新时没有问题,但我无法搜索或过滤推文中的关键字 我将以下命令放入repl中: (ns twitter-search.core (:require [twttr.api :as api ] [twttr.auth :refer [env->UserCredentials]])) (api/search-tweets creds :params {:q "footba

使用twttr和其他Clojure twitter api库,我在发送推文或更新时没有问题,但我无法搜索或过滤推文中的关键字

我将以下命令放入repl中:

(ns twitter-search.core
    (:require [twttr.api :as api ]
                    [twttr.auth :refer [env->UserCredentials]]))
(api/search-tweets creds :params {:q "football"})
然后输入凭据,如下所示:

(def app-consumer-key "my key from dev.twitter " )
应用消费者秘密访问和秘密令牌也是如此;在那里一切似乎都很好,因为当我输入repl app consumer key时,它返回的键都很好

那么对于凭证,我会:

(def creds (env->UserCredentials))
我通过编写一个小函数,让用户表现出良好的工作状态:

(defn show-user [handle]
    (api/users-show creds :params {:screen_name handle}))
然后,当我在repl中运行(显示用户“jack”)时,我得到了人们期望的所有json数据,因此一切都很好

我遇到的问题是搜索推文。当我将以下内容放入repl时:

(ns twitter-search.core
    (:require [twttr.api :as api ]
                    [twttr.auth :refer [env->UserCredentials]]))
(api/search-tweets creds :params {:q "football"})
它除了从当前名称空间出发外,什么也不做

twitter-search.core=>

如果你能指出我错在哪里,或者发一个如何搜索包含特定单词的推文的例子,我将不胜感激

我甚至做了长尾搜索,并从另一个twitter帐户发布了相同的术语,以查看我是否可以提示程序检测推特,但什么也没发生

(ns twitter-search.core
    (:require [twttr.api :as api ]
                    [twttr.auth :refer [env->UserCredentials]]))


(def app-consumer-key "my key from dev.twitter " )

(def creds (env->UserCredentials))

(defn show-user [handle]
    (api/users-show creds :params {:screen_name handle}))



;; The problem I am having is searching for tweets. 
;; When I put the following into the repl:

(api/search-tweets creds :params {:q "football"})

;; It does nothing, other than go from the current namespace 

twitter-search.core=>

;; To 

#_=> 
我只是想知道如何使用twttr clojure库根据推文中的某些关键字过滤推文。我知道这似乎是一个愚蠢的问题,但是,我是Clojure的新手,我在任何地方都没有找到一个有效的例子,并且已经尝试了很多次让它发挥作用。

我觉得很愚蠢:-(

我能够修复它,但不确定是什么导致了问题;我通常会尝试修复问题几次,并且通常在这里发布之前我会自己回答

无论如何,以下函数返回了我要查找的内容:

(defn keyword-return [keyword]
  (api/search-tweets creds :params {:q keyword})) 
你确定你在REPL上输入了你说的吗?
#u=>
用于表示你正在输入的表单尚未完成,需要更多的输入才能完成。这可能发生,例如,如果你忘记了结束语