我想在Twitter上搜索50個關鍵字。到目前爲止,我已經嘗試了兩種搜索Twitter的方法。第一種方法無論關鍵字如何,都只打印最後一條推文的數據。如何搜索大量推文
這是第一種方法我用:
for (i in c("#GMCR","#NFLX","#PCLN","#SWN","#MA","#EW","#WDC", "#ROST", "#RHT", "#ESRX", "#URBN", "#CRM", "#THC", "#BLK", "#AMZN", "#AAPL", "#CERN", "#FFIV", "#DTV", "#AZO", "#ISRG", "#SJM", "#EOG", "#OXY", "#CF", "#GIS", "#FLS", "#WMT", "#NTAP", "#HSP", "#CSX", "#ACT", "#MOS", "#TJX", "#CL", "#MCD", "#COG", "#RRC", "#FLIR", "#CTSH", "#MYL", "#LEG", "#APH", "#VAR", "#HAS", "#FSLR", "#APA", "#ABC", "#UNP", "#EL"))
{
tweet6<-searchTwitter(i,lang='en',since='2015-09-02', until='2015-09-03')
}
tweet6
這是第二種方法,我只是把50個關鍵字在searchTwitter()
功能,但它給一個403錯誤:
tweet6<-searchTwitter('#GMCR||#NFLX||#PCLN||#SWN||#MA||#EW||#WDC||#ROST||#RHT||#ESRX||#URBN||#CRM||#THC||#BLK||#AMZN||#AAPL||#CERN||#FFIV||#DTV||#AZO||#ISRG||#SJM||#EOG||#OXY||#CF||#GIS||#FLS||#WMT||#NTAP||#HSP||#CSX||#ACT||#MOS||#TJX||#CL||#MCD||#COG||#RRC||#FLIR||#CTSH||#MYL||#LEG||#APH||#VAR||#HAS||#FSLR||#APA||#ABC||#UNP||#EL',
n=500,lang='en,since='2015-09-02', until='2015-09-03')
這將返回:
Error in twInterfaceObj$doAPICall(cmd, params, "GET", ...) :
client error: (403) Forbidden
是不是股票的hastags,叫'cashtags'所以'#GMCR'會是'$ GMCR'? @DougwenKuei – Rime