Exemplo n.º 1
0
def main():

	couch = couchdb.Server('http://115.146.89.12:5984/');
	try:
		db = couch.create('tweets')
	except couchdb.http.PreconditionFailed as e:
		db = couch['tweets']

	client19 = testTweepy.clientKeys("727131792042430464-jm5PAa5baFRUiDiAnZAOhg71T3LUL3n","4zTxOKjnZS9gvaTUx2OZ8CqhCyNi5VpMETPHNCdCB3Upn","xFzz6VMUVhLSTzJqp2a8Dc014","F6etmx9ORRP0T9tSRShTPM2bzGI95Lik7mOxrCucfwTXD0NiVX",19)
	api19 = client19.OAuth()

	client20 = testTweepy.clientKeys("727131792042430464-5SxHiiBJ2jHE3hqMIxkMMYmObG6aPEY","wc5Scl4Win5KqpZVXrSp1TN9R4dRtJhm9Wx5O1SRyFt9k","63GgwRqGd4eLIjXQhcbgJnR7W","D0h7cIFtEAsk1oPQ9kZJmLw1StXZ79MPm7etl4rHbXcrm1PJfu",20)
	api20 = client20.OAuth()

	client21 = testTweepy.clientKeys("727131792042430464-QaPXJ2IxFAecrehN1P5PcBbvn7VYLmG","fPmGUCScPAZ8Vk3hZQHTrA9nrn6psRTLxXlRO5KeaTvmw","vl5SjNl7gjxfoLY6hAraPUka8","liXZwyO9DgAzcaKyAONnsJUFG7NrwJWNEBaVGrX46qnuIz3uXT",21)
	api21 = client21.OAuth()

	client22 = testTweepy.clientKeys("2723420030-1FxAMm8pMg9xPxoNAtBdvyOXgajvllf9QNYmOaY","aIabpM8rrgFY8CTbpEUdxA0f4TTpWrEBwnkyrctcgPbTM","FPttalYsxKxC0fdv5029IMsEe","71QCg37cEmQOEz2JpuR5TOfTN8cnLsLt6TOFAn5x996poQkG8K",22)
	api22 = client22.OAuth()

	client23 = testTweepy.clientKeys("2723420030-NRTtNrkYwBbGcrvZh5x3Epp8e1ZxwHJE3nAPm8W","QQB7dpIUX9sJubJ2yg8boy47puDWlPgKbCDIcxhL9s182","ZH8QIX0sy5agILRwURBKhVvIM","fNbzyvX7T8gZRYsZ9bZ9pO3XecngYKG6xA0ctPQmpUlKOqq6Qb",23)
	api23 = client23.OAuth()

	client24 = testTweepy.clientKeys("2723420030-f10SElof172GNPlsmvblyUb0G2ksIaMTaem6Nmd","xDLWpxyjFc3ZPZXJSTp6SZjly2hdOccUHeXl7gr3f37gf","JJfBFxvNN4RMKJwSzI92fmd3l","Bv1G95h1lIuW3PxzBNH9pE0vydL1YqlbwAqkINTTIDLTjYybSp",24)
	api24 = client24.OAuth()

	#read CSV File
	list1 = []
	with open('list5.csv', 'rb') as f:
		reader = csv.reader(f)
		for row in reader:
			list1.append(row)
	list2 = []
	with open('list6.csv', 'rb') as f:
		reader = csv.reader(f)
		for row in reader:
			list2.append(row)
	userTimelineCompany = []
	with open('smallData.csv', 'rb') as f:
		reader = csv.reader(f)
		for row in reader:
			userTimelineCompany.append(row)
	#step1:comany post, new thread
	collectUserTimeline_thread = testTweepy.getUserTimeline(db,api19,userTimelineCompany,"screenName")
	collectUserTimeline_thread.start()
	print "company user timelime start"
	#step2:find all followers
	followersIds1 = getFollowersIds(api20,list1)
	followersIds2 = getFollowersIds(api20,list2)
	#break point
	#step3:followers post,new thread
	collectFollowersTimeline_thread1 = testTweepy.getUserTimeline(db,api21,followersIds1,"user_id")
	collectFollowersTimeline_thread1.start()
	collectFollowersTimeline_thread2 = testTweepy.getUserTimeline(db,api22,followersIds2,"user_id")
	collectFollowersTimeline_thread2.start()
	print "followers timelime start"
	#step4:search, new thread

	search_thread1 = testTweepy.search(db,api23,list1)
	search_thread1.start()
	search_thread2 = testTweepy.search(db,api24,list2)
	search_thread2.start()
	print "search start"
	#step5:streaming,realtime data
	#This handles Twitter authetification and the connection to Twitter Streaming API
	# print "search ok~"
	#[[c1,a1],[c2,a2]]
	listOfCompany = list1
	listOfCompany.extend(list2)
	nameOfCompany = []
	tmp = []
	#[c1,a1,c2,a2]
	streamFilter = []
	for each in listOfCompany:
		tmp.append(each[0])
		tmp.append(each[2])
		nameOfCompany.append(tmp)
		streamFilter.append(each[0])
		streamFilter.append(each[2])
		tmp = []
	l = StdOutListener(db,nameOfCompany)
	auth = OAuthHandler('8FWIMWkMWaLKtbSyUkDcsAO8Z', 'JTPVp6izcJ73PSL4fbTaVWSFGFiJM4m0TZj1J5gSKtiuL6vaCA')
	auth.set_access_token('2723420030-WFrcjeXsVIV1AHgWZ1YhTVb7RCxmftZQB8D8IOW', 'EvAUoawFAdVPEfTjiRZY7xxAuyqNuLv4WVI86Eh797HUK')
	stream = Stream(auth, l)
	print "streaming start"

 #    #This line filter Twitter Streams to capture data by the keywords: 'python', 'javascript', 'ruby'
	stream.filter(track=streamFilter,languages = ["en"])
	print "main over"
Exemplo n.º 2
0
def main():

	couch = couchdb.Server('http://115.146.89.12:5984/');
	try:
		db = couch.create('tweets')
	except couchdb.http.PreconditionFailed as e:
		db = couch['tweets']

	client13 = testTweepy.clientKeys("137367359-xTFdQYSCcAJoPGlSyHuQAxP3ieLtGUiLN8FKiduI","QSAYSrDVRFOckQfJ5qxp4vrkPXDSIzbQKHFCTOtDJXSKx","nFhq44qf9GVoSp7DSfWtOYkI6","YXXsC47XryCaG5690Wj1rpHjHu791QEGIN7jIwimetZWX9FDph",13)
	api13 = client13.OAuth()

	client14 = testTweepy.clientKeys("3161564544-U6YLon0E6N7ZvHtfvoeHRSdlCp4NbjHGd1acrBN","FaaZcVA2847YNA2igjFjjKpQvIgVUCNlh8H3ZvP2ey0Ro","WxOvbrNAzyjy7vszxJ6OLeyol","1s7s2f4SeryTN374dGMvoSwtXM10JHOYRVEd6JcJirqFYK9BE9",14)
	api14 = client14.OAuth()

	client15 = testTweepy.clientKeys("128415623-tbIJqZujbYoYP4xsPleUWthHO7W6jnu5LscL6AAA","wSmbC1oRINjcnAvmCzbOABn8lsJ6GOxtZONGe6o80uEtr","OvFt3ix2aummG26HtS8sT1MzU","71tH27a3HljrW1cEOuoFZRPfmnZFqxhf4UXLI13rhgHfUA8mQ0",15)
	api15 = client15.OAuth()

	client16 = testTweepy.clientKeys("2401399747-HGxObwgYtp2aFO6whX0GoQwNEn4E4yxK7mkHjEn","miPNtaUNvGDct6oKWJKO9SNZYYdIAzMG2aHODnfgadwMM","tsa7I86gihfEKCRfyQ8sM3ruc","rgGJJPser76YhlljzVFvo2V5qUaoZnaGxxaC5CdyZBqsKgYEim",16)
	api16 = client16.OAuth()

	client17 = testTweepy.clientKeys("1345785727-4q81KjFTZc5oFu0eEi3uxpQxiIKQRv2qZKjpYQv","LxHj4ymGyvBrtVhTdXO1iBcskFemj4IYn6w0s9BD6K2K5","40pGYbUc8fZ5CkEsw4VTsyWqH","TIxs2MMNuSJkwAmuGWAdCOamNKtrI7VaPJelrAkPhI4kpw3pqm",17)
	api17 = client17.OAuth()

	client18 = testTweepy.clientKeys("3522828433-xdClye90mkKqwSXGMwpIvnOZsvtx5XaecCbmnMR","8D3jM1gsw0iTYKeJUvwGPqFkIbt2pweJWIDk2Gv5RZk1u","oboRwqkiL05oePIWXpRL8WJUF","IdGHjwmj3yS5U99Bb2rU1sGMBT2YKHMoIzJHvWopYb9Khxe7LQ",18)
	api18 = client18.OAuth()

	#read CSV File
	list1 = []
	with open('list3.csv', 'rb') as f:
		reader = csv.reader(f)
		for row in reader:
			list1.append(row)
	list2 = []
	with open('list4.csv', 'rb') as f:
		reader = csv.reader(f)
		for row in reader:
			list2.append(row)
	userTimelineCompany = []
	with open('smallData.csv', 'rb') as f:
		reader = csv.reader(f)
		for row in reader:
			userTimelineCompany.append(row)
	#step1:comany post, new thread
	collectUserTimeline_thread = testTweepy.getUserTimeline(db,api13,userTimelineCompany,"screenName")
	collectUserTimeline_thread.start()
	print "company user timelime start"
	#step2:find all followers
	followersIds1 = getFollowersIds(api14,list1)
	followersIds2 = getFollowersIds(api14,list2)
	#break point
	#step3:followers post,new thread
	collectFollowersTimeline_thread1 = testTweepy.getUserTimeline(db,api15,followersIds1,"user_id")
	collectFollowersTimeline_thread1.start()
	collectFollowersTimeline_thread2 = testTweepy.getUserTimeline(db,api16,followersIds2,"user_id")
	collectFollowersTimeline_thread2.start()
	print "followers timelime start"
	#step4:search, new thread

	search_thread1 = testTweepy.search(db,api17,list1)
	search_thread1.start()
	search_thread2 = testTweepy.search(db,api18,list2)
	search_thread2.start()
	print "search start"
	#step5:streaming,realtime data
	#This handles Twitter authetification and the connection to Twitter Streaming API
	# print "search ok~"
	#[[c1,a1],[c2,a2]]
	listOfCompany = list1
	listOfCompany.extend(list2)
	nameOfCompany = []
	tmp = []
	#[c1,a1,c2,a2]
	streamFilter = []
	for each in listOfCompany:
		tmp.append(each[0])
		tmp.append(each[2])
		nameOfCompany.append(tmp)
		streamFilter.append(each[0])
		streamFilter.append(each[2])
		tmp = []
	l = StdOutListener(db,nameOfCompany)
	auth = OAuthHandler('8FWIMWkMWaLKtbSyUkDcsAO8Z', 'JTPVp6izcJ73PSL4fbTaVWSFGFiJM4m0TZj1J5gSKtiuL6vaCA')
	auth.set_access_token('2723420030-WFrcjeXsVIV1AHgWZ1YhTVb7RCxmftZQB8D8IOW', 'EvAUoawFAdVPEfTjiRZY7xxAuyqNuLv4WVI86Eh797HUK')
	stream = Stream(auth, l)
	print "streaming start"

 #    #This line filter Twitter Streams to capture data by the keywords: 'python', 'javascript', 'ruby'
	stream.filter(track=streamFilter,languages = ["en"])
	print "main over"
Exemplo n.º 3
0
def main():

	couch = couchdb.Server('http://115.146.89.12:5984/');
	try:
		db = couch.create('tweets')
	except couchdb.http.PreconditionFailed as e:
		db = couch['tweets']

	client7 = testTweepy.clientKeys("2723420030-EplcykApi32aUOGYdTmYyvUDYkwS7EuwjpdjYpN","lpWqn6zRqThENXIeZA8urnC6OjPfa3sYNBIlDWpnpVwCv","h3rvFAz5iL5CO7009iBouOtMx","lX4SOmsMcpNwF8NWWEkN5Kommjw4wBXUsVLjLFUEJLgIHyxhVl",7)
	api7 = client7.OAuth()

	client8 = testTweepy.clientKeys("2723420030-9lm4QbApyJF3HrY3tDTXO0JrN5rlL64rJZid5j3","5lwziiIzHcg5NIrIxYqsaFLiRxUbH5xbmESPXi8VbzN2v","FILYNZgZnvZSmtCDAxrmc2oIQ","88afPKrcRhe6aGgvQVj0XCj1kFR3GIvizqqsatQSXD3KaXABc8",8)
	api8 = client8.OAuth()

	client9 = testTweepy.clientKeys("2723420030-84cDhUU44DH2rbYt0cZknt7tG2aNPsO7VvktvZH","ZxtiYFWpXUXuSaoLcw8oYua4Dv5y3veWg3qoM9Snb3tSg","Jau8yUmvwR2uS4zV1Karh5GQ5","A0g0urvJnT7T4MGZJ6ejuktApcACfTu0REZVNYtIwb48yYiXVS",9)
	api9 = client9.OAuth()

	client10 = testTweepy.clientKeys("2723420030-3MxAVSEemzOc1Cy42A1L6N9iUH3E1R7dbmDq0Yy","1J52pHsceIYsoEfwddyKJzjnUti2bByApfzyvWhZA7agu","Uh1Y838oM7Ft6cgBl1nz2YWXG","PEKEgE3CPbWhHzrf0ydrjez332fG2xfXjgyV5w1qbwvujo2djx",10)
	api10 = client10.OAuth()

	client11 = testTweepy.clientKeys("2723420030-iUTktQSByfp9o5AwyOJ7N0S3aD7nHTxF8BIjBIe","OKFML39rpJZVTvVazGNuB2vRiaKe2FMUwbrs8xVzaJ06z","aOjxmM1YBnLTcrZnhBI8C9ExO","FkvJ70j54lKV9rWR8rAb469psQ0JrgcjXj5bGw6aHf0oUFtXi4",11)
	api11 = client11.OAuth()

	client12 = testTweepy.clientKeys("2723420030-TUHv3ezbftRgTFiOpuP2GDjAfpfpDRQayctJ19f","EUwnQ10xCUF5KQI9ZoXdtVlG3xWVxDqRYNPXL008t1ISp","0W9781E4BdIb0E30sfsRgpSJP","l90cvuUgqHukfcqxYbiw4Mk2E2K0sWl4dUwlLGipAtYxUsxv4b",12)
	api12 = client12.OAuth()

	#read CSV File
	list1 = []
	with open('list1.csv', 'rb') as f:
		reader = csv.reader(f)
		for row in reader:
			list1.append(row)
	list2 = []
	with open('list2.csv', 'rb') as f:
		reader = csv.reader(f)
		for row in reader:
			list2.append(row)
	userTimelineCompany = []
	with open('smallData.csv', 'rb') as f:
		reader = csv.reader(f)
		for row in reader:
			userTimelineCompany.append(row)
	#step1:comany post, new thread
	collectUserTimeline_thread = testTweepy.getUserTimeline(db,api7,userTimelineCompany,"screenName")
	collectUserTimeline_thread.start()
	print "company user timelime start"
	#step2:find all followers
	followersIds1 = getFollowersIds(api8,list1)
	followersIds2 = getFollowersIds(api8,list2)
	#break point
	#step3:followers post,new thread
	collectFollowersTimeline_thread1 = testTweepy.getUserTimeline(db,api9,followersIds1,"user_id")
	collectFollowersTimeline_thread1.start()
	collectFollowersTimeline_thread2 = testTweepy.getUserTimeline(db,api10,followersIds2,"user_id")
	collectFollowersTimeline_thread2.start()
	print "followers timelime start"
	#step4:search, new thread

	search_thread1 = testTweepy.search(db,api11,list1)
	search_thread1.start()
	search_thread2 = testTweepy.search(db,api12,list2)
	search_thread2.start()
	print "search start"
	#step5:streaming,realtime data
	#This handles Twitter authetification and the connection to Twitter Streaming API
	# print "search ok~"
	#[[c1,a1],[c2,a2]]
	listOfCompany = list1
	listOfCompany.extend(list2)
	nameOfCompany = []
	tmp = []
	#[c1,a1,c2,a2]
	streamFilter = []
	for each in listOfCompany:
		tmp.append(each[0])
		tmp.append(each[2])
		nameOfCompany.append(tmp)
		streamFilter.append(each[0])
		streamFilter.append(each[2])
		tmp = []
	l = StdOutListener(db,nameOfCompany)
	auth = OAuthHandler('8FWIMWkMWaLKtbSyUkDcsAO8Z', 'JTPVp6izcJ73PSL4fbTaVWSFGFiJM4m0TZj1J5gSKtiuL6vaCA')
	auth.set_access_token('2723420030-WFrcjeXsVIV1AHgWZ1YhTVb7RCxmftZQB8D8IOW', 'EvAUoawFAdVPEfTjiRZY7xxAuyqNuLv4WVI86Eh797HUK')
	stream = Stream(auth, l)
	print "streaming start"

 #    #This line filter Twitter Streams to capture data by the keywords: 'python', 'javascript', 'ruby'
	stream.filter(track=streamFilter,languages = ["en"])
	print "main over"
Exemplo n.º 4
0
def main():
    #Create a database "tweets" in CouchDB, if it already exists, then get this database.
    couch = couchdb.Server()
    try:
        db = couch.create('tweets')
    except couchdb.http.PreconditionFailed as e:
        db = couch['tweets']
#Acquire authorization from Twiiter and create 6 tokens for querying through access tokens, access token secret, consumer key, consumer secret
    client1 = testTweepy.clientKeys(
        "2723420030-Z0LJ1sfonzSQogAM25oKmozVnJBZwDoVDawC2gA",
        "n2eyv44dYCgUX063M13VKqqWtNgAfYHl9W0g1lFBL0TAv",
        "h6ULJQTi8lb7mlS8eY52OxCIs",
        "0yKrZii3zQQETvgzL31ob53hLMdQAUGelYTKYvY5yq0JKIhy1R", 1)
    api1 = client1.OAuth()

    client2 = testTweepy.clientKeys(
        "2723420030-2lR2cPY92h8YWP9wjMPFCRfiWEVi35VMoi2NsT7",
        "ZHMNdF5iHTKKMYZaArcOJWPKnFD8IxafPp1kZQ2XLJz47",
        "RRUNpOEH6SoPP97l2YGHl0dQu",
        "9IEq0XWSDJ1Pt9rnMEfeKilznSS4mayYoWM8djyzM9DLPjw7Rh", 2)
    api2 = client2.OAuth()

    client3 = testTweepy.clientKeys(
        "2723420030-78QBg5F4msLFiPPkSCNPLZB7453bmd9UL4eK0Le",
        "i0joZvz2s0xXFcT0BM43s7FPABfqZY9mwM861Vw73zad6",
        "By8V2Yj8I7QTlMtYlTrLKgk4B",
        "tK3WyeSN8VQv7uTgHltA8m5yGhaFaUIM1LALXKj3Fil5iMjZ94", 3)
    api3 = client3.OAuth()

    client4 = testTweepy.clientKeys(
        "2723420030-hX3dtFJHtnj53kLOpTESpXzj4gyaoeXD2mX1EL8",
        "qwiX45pLgjFcGEDmbJXWtbVxg2nBrT0OcVRBfEJcyjfCt",
        "dNWIbuMo2OcDShfAAocfvvcv0",
        "Nj2gssyqGXvilTFNvTNqOLiIvGKuL1oQc53RDSsb7zM5kRW947", 4)
    api4 = client4.OAuth()

    client5 = testTweepy.clientKeys(
        "2723420030-vMSM6RDSGBmotIjRA3lafZTit23pBleSuqRvGmA",
        "X5jmlJs9jbFvgHegRU8pVPOJ4Ld4w4JLGz7pq5Guzg6MJ",
        "HqsxFgMwds7tIiYN71VrPV7D8",
        "m83kWRShTvOgCOSRpJaz7SE7fBv5XCaeo142p1w3aD14HKfpEy", 5)
    api5 = client5.OAuth()

    client6 = testTweepy.clientKeys(
        "2723420030-WFrcjeXsVIV1AHgWZ1YhTVb7RCxmftZQB8D8IOW",
        "EvAUoawFAdVPEfTjiRZY7xxAuyqNuLv4WVI86Eh797HUK",
        "8FWIMWkMWaLKtbSyUkDcsAO8Z",
        "JTPVp6izcJ73PSL4fbTaVWSFGFiJM4m0TZj1J5gSKtiuL6vaCA", 6)
    api6 = client6.OAuth()

    #read CSV File which contains information of all companies
    listOfCompany = []
    with open('smallData.csv', 'rb') as f:
        reader = csv.reader(f)
        for row in reader:
            listOfCompany.append(row)
    #step1: create a new thread for retrieving tweets that all companies posted
    collectUserTimeline_thread = testTweepy.getUserTimeline(
        db, api1, listOfCompany, "screenName")
    collectUserTimeline_thread.start()
    print "company user timelime start"
    #step2:find all followers for all companies
    followersIds = getFollowersIds(api2, listOfCompany)

    #step3: create a new thread for retrieving tweets that all followers of all companies posted and mentioned the corresponding company
    collectFollowersTimeline_thread = testTweepy.getUserTimeline(
        db, api3, followersIds, "user_id")
    collectFollowersTimeline_thread.start()
    print "followers timelime start"

    #step4: create a new thread for searching all relevant tweets for all companies
    search_thread = testTweepy.search(db, api6, listOfCompany)
    search_thread.start()
    print "search start"

    #step5: use streaming API to retrieve live tweets
    nameOfCompany = []
    tmp = []
    streamFilter = []
    for each in listOfCompany:
        tmp.append(each[0])
        tmp.append(each[2])
        nameOfCompany.append(tmp)
        streamFilter.append(each[0])
        streamFilter.append(each[2])
        tmp = []
    #This handles Twitter authetification and the connection to Twitter Streaming API
    l = StdOutListener(db, nameOfCompany)
    auth = OAuthHandler('8FWIMWkMWaLKtbSyUkDcsAO8Z',
                        'JTPVp6izcJ73PSL4fbTaVWSFGFiJM4m0TZj1J5gSKtiuL6vaCA')
    auth.set_access_token('2723420030-WFrcjeXsVIV1AHgWZ1YhTVb7RCxmftZQB8D8IOW',
                          'EvAUoawFAdVPEfTjiRZY7xxAuyqNuLv4WVI86Eh797HUK')
    stream = Stream(auth, l)
    print "streaming start"

    print "main over"
Exemplo n.º 5
0
def main():

    couch = couchdb.Server('http://115.146.89.12:5984/')
    try:
        db = couch.create('tweets')
    except couchdb.http.PreconditionFailed as e:
        db = couch['tweets']

    client13 = testTweepy.clientKeys(
        "137367359-xTFdQYSCcAJoPGlSyHuQAxP3ieLtGUiLN8FKiduI",
        "QSAYSrDVRFOckQfJ5qxp4vrkPXDSIzbQKHFCTOtDJXSKx",
        "nFhq44qf9GVoSp7DSfWtOYkI6",
        "YXXsC47XryCaG5690Wj1rpHjHu791QEGIN7jIwimetZWX9FDph", 13)
    api13 = client13.OAuth()

    client14 = testTweepy.clientKeys(
        "3161564544-U6YLon0E6N7ZvHtfvoeHRSdlCp4NbjHGd1acrBN",
        "FaaZcVA2847YNA2igjFjjKpQvIgVUCNlh8H3ZvP2ey0Ro",
        "WxOvbrNAzyjy7vszxJ6OLeyol",
        "1s7s2f4SeryTN374dGMvoSwtXM10JHOYRVEd6JcJirqFYK9BE9", 14)
    api14 = client14.OAuth()

    client15 = testTweepy.clientKeys(
        "128415623-tbIJqZujbYoYP4xsPleUWthHO7W6jnu5LscL6AAA",
        "wSmbC1oRINjcnAvmCzbOABn8lsJ6GOxtZONGe6o80uEtr",
        "OvFt3ix2aummG26HtS8sT1MzU",
        "71tH27a3HljrW1cEOuoFZRPfmnZFqxhf4UXLI13rhgHfUA8mQ0", 15)
    api15 = client15.OAuth()

    client16 = testTweepy.clientKeys(
        "2401399747-HGxObwgYtp2aFO6whX0GoQwNEn4E4yxK7mkHjEn",
        "miPNtaUNvGDct6oKWJKO9SNZYYdIAzMG2aHODnfgadwMM",
        "tsa7I86gihfEKCRfyQ8sM3ruc",
        "rgGJJPser76YhlljzVFvo2V5qUaoZnaGxxaC5CdyZBqsKgYEim", 16)
    api16 = client16.OAuth()

    client17 = testTweepy.clientKeys(
        "1345785727-4q81KjFTZc5oFu0eEi3uxpQxiIKQRv2qZKjpYQv",
        "LxHj4ymGyvBrtVhTdXO1iBcskFemj4IYn6w0s9BD6K2K5",
        "40pGYbUc8fZ5CkEsw4VTsyWqH",
        "TIxs2MMNuSJkwAmuGWAdCOamNKtrI7VaPJelrAkPhI4kpw3pqm", 17)
    api17 = client17.OAuth()

    client18 = testTweepy.clientKeys(
        "3522828433-xdClye90mkKqwSXGMwpIvnOZsvtx5XaecCbmnMR",
        "8D3jM1gsw0iTYKeJUvwGPqFkIbt2pweJWIDk2Gv5RZk1u",
        "oboRwqkiL05oePIWXpRL8WJUF",
        "IdGHjwmj3yS5U99Bb2rU1sGMBT2YKHMoIzJHvWopYb9Khxe7LQ", 18)
    api18 = client18.OAuth()

    #read CSV File
    list1 = []
    with open('list3.csv', 'rb') as f:
        reader = csv.reader(f)
        for row in reader:
            list1.append(row)
    list2 = []
    with open('list4.csv', 'rb') as f:
        reader = csv.reader(f)
        for row in reader:
            list2.append(row)
    userTimelineCompany = []
    with open('smallData.csv', 'rb') as f:
        reader = csv.reader(f)
        for row in reader:
            userTimelineCompany.append(row)
    #step1:comany post, new thread
    collectUserTimeline_thread = testTweepy.getUserTimeline(
        db, api13, userTimelineCompany, "screenName")
    collectUserTimeline_thread.start()
    print "company user timelime start"
    #step2:find all followers
    followersIds1 = getFollowersIds(api14, list1)
    followersIds2 = getFollowersIds(api14, list2)
    #break point
    #step3:followers post,new thread
    collectFollowersTimeline_thread1 = testTweepy.getUserTimeline(
        db, api15, followersIds1, "user_id")
    collectFollowersTimeline_thread1.start()
    collectFollowersTimeline_thread2 = testTweepy.getUserTimeline(
        db, api16, followersIds2, "user_id")
    collectFollowersTimeline_thread2.start()
    print "followers timelime start"
    #step4:search, new thread

    search_thread1 = testTweepy.search(db, api17, list1)
    search_thread1.start()
    search_thread2 = testTweepy.search(db, api18, list2)
    search_thread2.start()
    print "search start"
    #step5:streaming,realtime data
    #This handles Twitter authetification and the connection to Twitter Streaming API
    # print "search ok~"
    #[[c1,a1],[c2,a2]]
    listOfCompany = list1
    listOfCompany.extend(list2)
    nameOfCompany = []
    tmp = []
    #[c1,a1,c2,a2]
    streamFilter = []
    for each in listOfCompany:
        tmp.append(each[0])
        tmp.append(each[2])
        nameOfCompany.append(tmp)
        streamFilter.append(each[0])
        streamFilter.append(each[2])
        tmp = []
    l = StdOutListener(db, nameOfCompany)
    auth = OAuthHandler('8FWIMWkMWaLKtbSyUkDcsAO8Z',
                        'JTPVp6izcJ73PSL4fbTaVWSFGFiJM4m0TZj1J5gSKtiuL6vaCA')
    auth.set_access_token('2723420030-WFrcjeXsVIV1AHgWZ1YhTVb7RCxmftZQB8D8IOW',
                          'EvAUoawFAdVPEfTjiRZY7xxAuyqNuLv4WVI86Eh797HUK')
    stream = Stream(auth, l)
    print "streaming start"

    #    #This line filter Twitter Streams to capture data by the keywords: 'python', 'javascript', 'ruby'
    stream.filter(track=streamFilter, languages=["en"])
    print "main over"
Exemplo n.º 6
0
def main():
#Create a database "tweets" in CouchDB, if it already exists, then get this database.
	couch = couchdb.Server()
	try:
		db = couch.create('tweets')
	except couchdb.http.PreconditionFailed as e:
		db = couch['tweets']
#Acquire authorization from Twiiter and create 6 tokens for querying through access tokens, access token secret, consumer key, consumer secret
	client1 = testTweepy.clientKeys("2723420030-Z0LJ1sfonzSQogAM25oKmozVnJBZwDoVDawC2gA","n2eyv44dYCgUX063M13VKqqWtNgAfYHl9W0g1lFBL0TAv","h6ULJQTi8lb7mlS8eY52OxCIs","0yKrZii3zQQETvgzL31ob53hLMdQAUGelYTKYvY5yq0JKIhy1R",1)
	api1 = client1.OAuth()

	client2 = testTweepy.clientKeys("2723420030-2lR2cPY92h8YWP9wjMPFCRfiWEVi35VMoi2NsT7","ZHMNdF5iHTKKMYZaArcOJWPKnFD8IxafPp1kZQ2XLJz47","RRUNpOEH6SoPP97l2YGHl0dQu","9IEq0XWSDJ1Pt9rnMEfeKilznSS4mayYoWM8djyzM9DLPjw7Rh",2)
	api2 = client2.OAuth()

	client3 = testTweepy.clientKeys("2723420030-78QBg5F4msLFiPPkSCNPLZB7453bmd9UL4eK0Le","i0joZvz2s0xXFcT0BM43s7FPABfqZY9mwM861Vw73zad6","By8V2Yj8I7QTlMtYlTrLKgk4B","tK3WyeSN8VQv7uTgHltA8m5yGhaFaUIM1LALXKj3Fil5iMjZ94",3)
	api3 = client3.OAuth()

	client4 = testTweepy.clientKeys("2723420030-hX3dtFJHtnj53kLOpTESpXzj4gyaoeXD2mX1EL8","qwiX45pLgjFcGEDmbJXWtbVxg2nBrT0OcVRBfEJcyjfCt","dNWIbuMo2OcDShfAAocfvvcv0","Nj2gssyqGXvilTFNvTNqOLiIvGKuL1oQc53RDSsb7zM5kRW947",4)
	api4 = client4.OAuth()

	client5 = testTweepy.clientKeys("2723420030-vMSM6RDSGBmotIjRA3lafZTit23pBleSuqRvGmA","X5jmlJs9jbFvgHegRU8pVPOJ4Ld4w4JLGz7pq5Guzg6MJ","HqsxFgMwds7tIiYN71VrPV7D8","m83kWRShTvOgCOSRpJaz7SE7fBv5XCaeo142p1w3aD14HKfpEy",5)
	api5 = client5.OAuth()

	client6 = testTweepy.clientKeys("2723420030-WFrcjeXsVIV1AHgWZ1YhTVb7RCxmftZQB8D8IOW","EvAUoawFAdVPEfTjiRZY7xxAuyqNuLv4WVI86Eh797HUK","8FWIMWkMWaLKtbSyUkDcsAO8Z","JTPVp6izcJ73PSL4fbTaVWSFGFiJM4m0TZj1J5gSKtiuL6vaCA",6)
	api6 = client6.OAuth()

	#read CSV File which contains information of all companies
	listOfCompany = []
	with open('smallData.csv', 'rb') as f:
		reader = csv.reader(f)
		for row in reader:
			listOfCompany.append(row)
	#step1: create a new thread for retrieving tweets that all companies posted
	collectUserTimeline_thread = testTweepy.getUserTimeline(db,api1,listOfCompany,"screenName")
	collectUserTimeline_thread.start()
	print "company user timelime start"
	#step2:find all followers for all companies
	followersIds = getFollowersIds(api2,listOfCompany)

	#step3: create a new thread for retrieving tweets that all followers of all companies posted and mentioned the corresponding company
	collectFollowersTimeline_thread = testTweepy.getUserTimeline(db,api3,followersIds,"user_id")
	collectFollowersTimeline_thread.start()
	print "followers timelime start"

	#step4: create a new thread for searching all relevant tweets for all companies
	search_thread = testTweepy.search(db,api6,listOfCompany)
	search_thread.start()
	print "search start"

	#step5: use streaming API to retrieve live tweets
	nameOfCompany = []
	tmp = []
	streamFilter = []
	for each in listOfCompany:
		tmp.append(each[0])
		tmp.append(each[2])
		nameOfCompany.append(tmp)
		streamFilter.append(each[0])
		streamFilter.append(each[2])
		tmp = []
	#This handles Twitter authetification and the connection to Twitter Streaming API
	l = StdOutListener(db,nameOfCompany)
	auth = OAuthHandler('8FWIMWkMWaLKtbSyUkDcsAO8Z', 'JTPVp6izcJ73PSL4fbTaVWSFGFiJM4m0TZj1J5gSKtiuL6vaCA')
	auth.set_access_token('2723420030-WFrcjeXsVIV1AHgWZ1YhTVb7RCxmftZQB8D8IOW', 'EvAUoawFAdVPEfTjiRZY7xxAuyqNuLv4WVI86Eh797HUK')
	stream = Stream(auth, l)
	print "streaming start"

	print "main over"
Exemplo n.º 7
0
def main():

    couch = couchdb.Server('http://115.146.89.12:5984/')
    try:
        db = couch.create('tweets')
    except couchdb.http.PreconditionFailed as e:
        db = couch['tweets']

    client19 = testTweepy.clientKeys(
        "727131792042430464-jm5PAa5baFRUiDiAnZAOhg71T3LUL3n",
        "4zTxOKjnZS9gvaTUx2OZ8CqhCyNi5VpMETPHNCdCB3Upn",
        "xFzz6VMUVhLSTzJqp2a8Dc014",
        "F6etmx9ORRP0T9tSRShTPM2bzGI95Lik7mOxrCucfwTXD0NiVX", 19)
    api19 = client19.OAuth()

    client20 = testTweepy.clientKeys(
        "727131792042430464-5SxHiiBJ2jHE3hqMIxkMMYmObG6aPEY",
        "wc5Scl4Win5KqpZVXrSp1TN9R4dRtJhm9Wx5O1SRyFt9k",
        "63GgwRqGd4eLIjXQhcbgJnR7W",
        "D0h7cIFtEAsk1oPQ9kZJmLw1StXZ79MPm7etl4rHbXcrm1PJfu", 20)
    api20 = client20.OAuth()

    client21 = testTweepy.clientKeys(
        "727131792042430464-QaPXJ2IxFAecrehN1P5PcBbvn7VYLmG",
        "fPmGUCScPAZ8Vk3hZQHTrA9nrn6psRTLxXlRO5KeaTvmw",
        "vl5SjNl7gjxfoLY6hAraPUka8",
        "liXZwyO9DgAzcaKyAONnsJUFG7NrwJWNEBaVGrX46qnuIz3uXT", 21)
    api21 = client21.OAuth()

    client22 = testTweepy.clientKeys(
        "2723420030-1FxAMm8pMg9xPxoNAtBdvyOXgajvllf9QNYmOaY",
        "aIabpM8rrgFY8CTbpEUdxA0f4TTpWrEBwnkyrctcgPbTM",
        "FPttalYsxKxC0fdv5029IMsEe",
        "71QCg37cEmQOEz2JpuR5TOfTN8cnLsLt6TOFAn5x996poQkG8K", 22)
    api22 = client22.OAuth()

    client23 = testTweepy.clientKeys(
        "2723420030-NRTtNrkYwBbGcrvZh5x3Epp8e1ZxwHJE3nAPm8W",
        "QQB7dpIUX9sJubJ2yg8boy47puDWlPgKbCDIcxhL9s182",
        "ZH8QIX0sy5agILRwURBKhVvIM",
        "fNbzyvX7T8gZRYsZ9bZ9pO3XecngYKG6xA0ctPQmpUlKOqq6Qb", 23)
    api23 = client23.OAuth()

    client24 = testTweepy.clientKeys(
        "2723420030-f10SElof172GNPlsmvblyUb0G2ksIaMTaem6Nmd",
        "xDLWpxyjFc3ZPZXJSTp6SZjly2hdOccUHeXl7gr3f37gf",
        "JJfBFxvNN4RMKJwSzI92fmd3l",
        "Bv1G95h1lIuW3PxzBNH9pE0vydL1YqlbwAqkINTTIDLTjYybSp", 24)
    api24 = client24.OAuth()

    # #read CSV File
    # list1 = []
    # with open('list5.csv', 'rb') as f:
    # 	reader = csv.reader(f)
    # 	for row in reader:
    # 		list1.append(row)
    # list2 = []
    # with open('list6.csv', 'rb') as f:
    # 	reader = csv.reader(f)
    # 	for row in reader:
    # 		list2.append(row)
    userTimelineCompany = []
    with open('smallData.csv', 'rb') as f:
        reader = csv.reader(f)
        for row in reader:
            userTimelineCompany.append(row)
    # #step1:comany post, new thread
    # collectUserTimeline_thread = testTweepy.getUserTimeline(db,api19,userTimelineCompany,"screenName")
    # collectUserTimeline_thread.start()
    # print "company user timelime start"
    # #step2:find all followers
    # followersIds1 = getFollowersIds(api20,list1)
    # followersIds2 = getFollowersIds(api20,list2)
    # #break point
    # #step3:followers post,new thread
    # collectFollowersTimeline_thread1 = testTweepy.getUserTimeline(db,api21,followersIds1,"user_id")
    # collectFollowersTimeline_thread1.start()
    # collectFollowersTimeline_thread2 = testTweepy.getUserTimeline(db,api22,followersIds2,"user_id")
    # collectFollowersTimeline_thread2.start()
    # print "followers timelime start"
    # #step4:search, new thread

    # search_thread1 = testTweepy.search(db,api23,list1)
    # search_thread1.start()
    # search_thread2 = testTweepy.search(db,api24,list2)
    # search_thread2.start()
    # print "search start"
    # #step5:streaming,realtime data
    # #This handles Twitter authetification and the connection to Twitter Streaming API
    # # print "search ok~"
    # #[[c1,a1],[c2,a2]]
    listOfCompany = userTimelineCompany
    nameOfCompany = []
    tmp = []
    #[c1,a1,c2,a2]
    streamFilter = []
    for each in listOfCompany:
        tmp.append(each[0])
        tmp.append(each[2])
        nameOfCompany.append(tmp)
        streamFilter.append(each[0])
        streamFilter.append(each[2])
        tmp = []
    l = StdOutListener(db, nameOfCompany)
    auth = OAuthHandler('8FWIMWkMWaLKtbSyUkDcsAO8Z',
                        'JTPVp6izcJ73PSL4fbTaVWSFGFiJM4m0TZj1J5gSKtiuL6vaCA')
    auth.set_access_token('2723420030-WFrcjeXsVIV1AHgWZ1YhTVb7RCxmftZQB8D8IOW',
                          'EvAUoawFAdVPEfTjiRZY7xxAuyqNuLv4WVI86Eh797HUK')
    stream = Stream(auth, l)
    print "streaming start"

    #    #This line filter Twitter Streams to capture data by the keywords: 'python', 'javascript', 'ruby'
    while (True):
        try:
            stream.filter(track=streamFilter, languages=["en"])
            print "main over"
        except Exception, e:
            print "streaming exception"
Exemplo n.º 8
0
def main():

    couch = couchdb.Server('http://115.146.89.12:5984/')
    try:
        db = couch.create('tweets')
    except couchdb.http.PreconditionFailed as e:
        db = couch['tweets']

    client25 = testTweepy.clientKeys(
        "2723420030-7Rcvp9nXIIPGWB8IsOCMkts4YHcXPom36FCtT9L",
        "gjg5RFYRHJrU6aEMT8MvKzCTORgyc0iYrfYB0KwdtpqJB",
        "b3mRv2HYjPoekuE0AjHVhxHFg",
        "zY42dCT8c2PhWj4qBE7ZKTbVIIEGTRfvyRXsAZ4ZQYo6O1s673", 25)
    api25 = client25.OAuth()

    client26 = testTweepy.clientKeys(
        "2723420030-WSRBT6DX4y8yNf2FnKPQxgomXcirYscQQf7E2DF",
        "073SmrI7FQ3NKZcRUfyOYkRBbM3Y9kh39nvkQYaBuEasq",
        "dIZDF4GTsaua8q00hky8S9w96",
        "w2NX30Gg6yPPtwR8GerXCkDag8MewY6GqLWHQSEqxmw59EXyjn", 26)
    api26 = client26.OAuth()

    client27 = testTweepy.clientKeys(
        "2723420030-dbLrRNNcPdDVVN9vU6gNe6ezmJIjBiFSTA4tZIK",
        "iQDLE1UeBMsO1AAH12jxHz4eYscKbqYBCOzYPz4v8Wrm6",
        "b9lVAy5VBbePQPsqxQvCW6bbn",
        "C8ZMEtz6BOF8kNkotmLmJULvgyZW50r7FirDn5AJkpyjtHi61a", 27)
    api27 = client27.OAuth()

    client28 = testTweepy.clientKeys(
        "727698246571724800-pTS7vQrpXzkcZy2Xa252bA91V9eyAuX",
        "Auw6gec17e93VNaT3RZylhEJcpZS6U2yoTRR8JgNet8Kg",
        "wkVCCl1aXTrDXHiAqqUW5rSKs",
        "heZKoWPP4dbCUf905gnx6pSrXugPYLOYuCLHTUtB8rMVy6SFgm", 28)
    api28 = client28.OAuth()

    client29 = testTweepy.clientKeys(
        "727698246571724800-nGxWtkrotWU82YaPjLqxqT8fYfgFq8H",
        "9IOjOsWzfzsSG9FiTsIRCmt949bwnygAI4x5m1ne8PCar",
        "HafWlU6lhWNSnPBZ6LOzQTTPk",
        "cLwesptc8NELKP9vOGIjlN8j33i7EZkBmE7nJRwNOHdIck0sRg", 29)
    api29 = client29.OAuth()

    client30 = testTweepy.clientKeys(
        "727698246571724800-yaJtodv2gaAFzw5DNZSebKHYwD5RTBB",
        "R8oqgADtOIOHhxfVtAfQIH47X4lJf9Txc1XIY093OxzwQ",
        "RbR0qPH7aB3OPY5c1MxX1ydwV",
        "eEL4AUFYfJb2esMCW32f228ycdvOd9lujKUBKWJyFLXF5tmFbE", 24)
    api30 = client30.OAuth()

    #read CSV File
    list1 = []
    with open('list7.csv', 'rb') as f:
        reader = csv.reader(f)
        for row in reader:
            list1.append(row)
    list2 = []
    with open('list8.csv', 'rb') as f:
        reader = csv.reader(f)
        for row in reader:
            list2.append(row)
    userTimelineCompany = []
    with open('smallData.csv', 'rb') as f:
        reader = csv.reader(f)
        for row in reader:
            userTimelineCompany.append(row)
    #step1:comany post, new thread
    collectUserTimeline_thread = testTweepy.getUserTimeline(
        db, api25, userTimelineCompany, "screenName")
    collectUserTimeline_thread.start()
    print "company user timelime start"
    #step2:find all followers
    followersIds1 = getFollowersIds(api26, list1)
    followersIds2 = getFollowersIds(api26, list2)
    #break point
    #step3:followers post,new thread
    collectFollowersTimeline_thread1 = testTweepy.getUserTimeline(
        db, api27, followersIds1, "user_id")
    collectFollowersTimeline_thread1.start()
    collectFollowersTimeline_thread2 = testTweepy.getUserTimeline(
        db, api28, followersIds2, "user_id")
    collectFollowersTimeline_thread2.start()
    print "followers timelime start"
    #step4:search, new thread

    search_thread1 = testTweepy.search(db, api29, list1)
    search_thread1.start()
    search_thread2 = testTweepy.search(db, api30, list2)
    search_thread2.start()
    print "search start"
    #step5:streaming,realtime data
    #This handles Twitter authetification and the connection to Twitter Streaming API
    # print "search ok~"
    #[[c1,a1],[c2,a2]]
    listOfCompany = list1
    listOfCompany.extend(list2)
    nameOfCompany = []
    tmp = []
    #[c1,a1,c2,a2]
    streamFilter = []
    for each in listOfCompany:
        tmp.append(each[0])
        tmp.append(each[2])
        nameOfCompany.append(tmp)
        streamFilter.append(each[0])
        streamFilter.append(each[2])
        tmp = []
    l = StdOutListener(db, nameOfCompany)
    auth = OAuthHandler('8FWIMWkMWaLKtbSyUkDcsAO8Z',
                        'JTPVp6izcJ73PSL4fbTaVWSFGFiJM4m0TZj1J5gSKtiuL6vaCA')
    auth.set_access_token('2723420030-WFrcjeXsVIV1AHgWZ1YhTVb7RCxmftZQB8D8IOW',
                          'EvAUoawFAdVPEfTjiRZY7xxAuyqNuLv4WVI86Eh797HUK')
    stream = Stream(auth, l)
    print "streaming start"

    #    #This line filter Twitter Streams to capture data by the keywords: 'python', 'javascript', 'ruby'
    stream.filter(track=streamFilter, languages=["en"])
    print "main over"
Exemplo n.º 9
0
def main():

	couch = couchdb.Server('http://115.146.89.12:5984/');
	try:
		db = couch.create('tweets')
	except couchdb.http.PreconditionFailed as e:
		db = couch['tweets']

	client25 = testTweepy.clientKeys("2723420030-7Rcvp9nXIIPGWB8IsOCMkts4YHcXPom36FCtT9L","gjg5RFYRHJrU6aEMT8MvKzCTORgyc0iYrfYB0KwdtpqJB","b3mRv2HYjPoekuE0AjHVhxHFg","zY42dCT8c2PhWj4qBE7ZKTbVIIEGTRfvyRXsAZ4ZQYo6O1s673",25)
	api25 = client25.OAuth()

	client26 = testTweepy.clientKeys("2723420030-WSRBT6DX4y8yNf2FnKPQxgomXcirYscQQf7E2DF","073SmrI7FQ3NKZcRUfyOYkRBbM3Y9kh39nvkQYaBuEasq","dIZDF4GTsaua8q00hky8S9w96","w2NX30Gg6yPPtwR8GerXCkDag8MewY6GqLWHQSEqxmw59EXyjn",26)
	api26 = client26.OAuth()

	client27 = testTweepy.clientKeys("2723420030-dbLrRNNcPdDVVN9vU6gNe6ezmJIjBiFSTA4tZIK","iQDLE1UeBMsO1AAH12jxHz4eYscKbqYBCOzYPz4v8Wrm6","b9lVAy5VBbePQPsqxQvCW6bbn","C8ZMEtz6BOF8kNkotmLmJULvgyZW50r7FirDn5AJkpyjtHi61a",27)
	api27 = client27.OAuth()

	client28 = testTweepy.clientKeys("727698246571724800-pTS7vQrpXzkcZy2Xa252bA91V9eyAuX","Auw6gec17e93VNaT3RZylhEJcpZS6U2yoTRR8JgNet8Kg","wkVCCl1aXTrDXHiAqqUW5rSKs","heZKoWPP4dbCUf905gnx6pSrXugPYLOYuCLHTUtB8rMVy6SFgm",28)
	api28 = client28.OAuth()

	client29 = testTweepy.clientKeys("727698246571724800-nGxWtkrotWU82YaPjLqxqT8fYfgFq8H","9IOjOsWzfzsSG9FiTsIRCmt949bwnygAI4x5m1ne8PCar","HafWlU6lhWNSnPBZ6LOzQTTPk","cLwesptc8NELKP9vOGIjlN8j33i7EZkBmE7nJRwNOHdIck0sRg",29)
	api29 = client29.OAuth()

	client30 = testTweepy.clientKeys("727698246571724800-yaJtodv2gaAFzw5DNZSebKHYwD5RTBB","R8oqgADtOIOHhxfVtAfQIH47X4lJf9Txc1XIY093OxzwQ","RbR0qPH7aB3OPY5c1MxX1ydwV","eEL4AUFYfJb2esMCW32f228ycdvOd9lujKUBKWJyFLXF5tmFbE",24)
	api30 = client30.OAuth()

	#read CSV File
	list1 = []
	with open('list7.csv', 'rb') as f:
		reader = csv.reader(f)
		for row in reader:
			list1.append(row)
	list2 = []
	with open('list8.csv', 'rb') as f:
		reader = csv.reader(f)
		for row in reader:
			list2.append(row)
	userTimelineCompany = []
	with open('smallData.csv', 'rb') as f:
		reader = csv.reader(f)
		for row in reader:
			userTimelineCompany.append(row)
	#step1:comany post, new thread
	collectUserTimeline_thread = testTweepy.getUserTimeline(db,api25,userTimelineCompany,"screenName")
	collectUserTimeline_thread.start()
	print "company user timelime start"
	#step2:find all followers
	followersIds1 = getFollowersIds(api26,list1)
	followersIds2 = getFollowersIds(api26,list2)
	#break point
	#step3:followers post,new thread
	collectFollowersTimeline_thread1 = testTweepy.getUserTimeline(db,api27,followersIds1,"user_id")
	collectFollowersTimeline_thread1.start()
	collectFollowersTimeline_thread2 = testTweepy.getUserTimeline(db,api28,followersIds2,"user_id")
	collectFollowersTimeline_thread2.start()
	print "followers timelime start"
	#step4:search, new thread

	search_thread1 = testTweepy.search(db,api29,list1)
	search_thread1.start()
	search_thread2 = testTweepy.search(db,api30,list2)
	search_thread2.start()
	print "search start"
	#step5:streaming,realtime data
	#This handles Twitter authetification and the connection to Twitter Streaming API
	# print "search ok~"
	#[[c1,a1],[c2,a2]]
	listOfCompany = list1
	listOfCompany.extend(list2)
	nameOfCompany = []
	tmp = []
	#[c1,a1,c2,a2]
	streamFilter = []
	for each in listOfCompany:
		tmp.append(each[0])
		tmp.append(each[2])
		nameOfCompany.append(tmp)
		streamFilter.append(each[0])
		streamFilter.append(each[2])
		tmp = []
	l = StdOutListener(db,nameOfCompany)
	auth = OAuthHandler('8FWIMWkMWaLKtbSyUkDcsAO8Z', 'JTPVp6izcJ73PSL4fbTaVWSFGFiJM4m0TZj1J5gSKtiuL6vaCA')
	auth.set_access_token('2723420030-WFrcjeXsVIV1AHgWZ1YhTVb7RCxmftZQB8D8IOW', 'EvAUoawFAdVPEfTjiRZY7xxAuyqNuLv4WVI86Eh797HUK')
	stream = Stream(auth, l)
	print "streaming start"

 #    #This line filter Twitter Streams to capture data by the keywords: 'python', 'javascript', 'ruby'
	stream.filter(track=streamFilter,languages = ["en"])
	print "main over"