我只是想知道是否可以使用tweepy制作扫描仪 - 例如,一个不断搜索某些单词的while循环。我是一名交易员,如果有任何突发新闻,我会发现它非常有用。
示例:
我想设置我的扫描仪,以便不断返回包含$ DB'在他们中。此外,我只想返回有>的用户的推文。 5k粉丝。
任何建议或指示都会有所帮助!感谢。
答案 0 :(得分:2)
编辑/更新:正如asongtoruin和qorka所讨论的那样,问题是要求新推文,而不是现有的推文。以前的编辑使用import cv2
camera = cv2.VideoCapture("video.avi")
car_cascade = cv2.CascadeClassifier('cars.xml')
# Get frames per second from video file. Syntax depends on OpenCV version:
(major_ver, minor_ver, subminor_ver) = (cv2.__version__).split('.')
if int(major_ver) < 3 :
fps = camera.get(cv2.cv.CV_CAP_PROP_FPS)
else :
fps = camera.get(cv2.CAP_PROP_FPS)
#:if
intTimeToNextFrame=int(1000.0/fps)-12 # '-12' estimation of time for processing
while True:
(grabbed,frame) = camera.read()
grayvideo = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
cars = car_cascade.detectMultiScale(grayvideo, 1.1, 1)
for (x,y,w,h) in cars:
cv2.rectangle(frame,(x,y),(x+w,y+h),(255,0,255),1)
cv2.imshow("video",frame)
if cv2.waitKey(intTimeToNextFrame)== ord('q'):
break
camera.release()
cv2.destroyAllWindows()
方法,该方法仅查找现有消息。 StreamListener会读取新邮件。
api.search