def retrieveMediaBasedTags(self,ID,Q,geoDict): '''instagram feeds this function is hanging correct it ''' logger.debug('retrieve instagram medias') #tag search in instagram remove comma #Q.replace(',','') feedJson = instagramInt.retrieveMediaBasedTags(Q,geoDict) if geoDict: logger.debug('geoDict for instagram based media retrieve %s',geoDict) feedJson.extend(instagramInt.getLocationSearch(geoDict)) #else: # # Example addr: 875 N Michigan Ave, Chicago, IL 60611 # results = Geocoder.geocode(Q) # latlng=results.coordinates # logger.debug('google geocode api coordinate pair:%s',latlng) # geoDict.update({'lat':latlng[0]}) # geoDict.update({'lng':latlng[1]}) # geoDict.update({'distance':'.5'})#default radius =500m #logger.debug('geo cord to search in instagram is %s',geoDict) #feedJson.extend(instagramInt.getLocationSearch(geoDict)) #feedJson = json.loads(feedJson) map(lambda tw:tw.update({'created_time': int(tw['created_time'])}),feedJson) #convert string to int logger.debug('store instagram media in mongoDb') #use spark removed unwanted feilds in json & add a key:value #feedJson=sparkInt.wowFieldTrueOrFalse(feedJson) self.insertFeedData(ID,feedJson) # below returning to be removed has to be done from mongoDB only return len(feedJson)
def retrieveMediaBasedTags(self,ID,Q,geoDict): '''instagram feeds this function is hanging correct it ''' passCnt = 0 logger.debug('retrieve instagram medias') #tag search in instagram remove comma #Q.replace(',','') feedJson = instagramInt.retrieveMediaBasedTags(Q,geoDict) if geoDict: logger.debug('geoDict for instagram based media retrieve %s',geoDict) feedJson.extend(instagramInt.getLocationSearch(geoDict)) #else: # # Example addr: 875 N Michigan Ave, Chicago, IL 60611 # results = Geocoder.geocode(Q) # latlng=results.coordinates # logger.debug('google geocode api coordinate pair:%s',latlng) # geoDict.update({'lat':latlng[0]}) # geoDict.update({'lng':latlng[1]}) # geoDict.update({'distance':'.5'})#default radius =500m #logger.debug('geo cord to search in instagram is %s',geoDict) #feedJson.extend(instagramInt.getLocationSearch(geoDict)) #feedJson = json.loads(feedJson) map(lambda tw:tw.update({'created_time': int(tw['created_time'])}),feedJson) #convert string to int logger.debug('store instagram media in mongoDb') #use spark removed unwanted feilds in json & add a key:value #feedJson=sparkInt.wowFieldTrueOrFalse(feedJson) passCnt += mongoInt.insertFeedData(ID,feedJson) # below returning to be removed has to be done from mongoDB only return feedJson
def retrieveLocationBasedTags(self,geoCode): ''' the slidebar feature based on radius dragging is done here both twitter & instagram datas are retrieved''' passCnt = 0 feedList=[] feedList.extend(twitterInt.retrieveTweetBasedLocation(geoCode)) #do a reverse geocoding and hit with feeds feedList.extend(instagramInt.getLocationSearch(geoCode)) #passCnt += mongoInt.insertInstagramUserLoginData(user) random.shuffle(feedList) return feedList