Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistencies with newlines #21

Closed
mwang25277 opened this issue Mar 29, 2017 · 1 comment
Closed

Inconsistencies with newlines #21

mwang25277 opened this issue Mar 29, 2017 · 1 comment
Labels

Comments

@mwang25277
Copy link

wangm13-tweets.zip

Attached is a csv file generated using jsonexport to convert Twitter data (100 tweets) from the Streaming API (in JSON) to the given csv file.

  `twitStream.on('tweet', function(tweet) {
	counter++;
	tweets.push(tweet);
	if(counter == count) {
		twitStream.stop();
		var parsedTweets = [];
		for(aTweet in tweets) {
			var parsed = {
				created_at: tweets[aTweet].created_at,
				id: tweets[aTweet].id,
				text: tweets[aTweet].text,
				user_id: tweets[aTweet].user.id,
				user_name: tweets[aTweet].user.name,
				user_screen_name: tweets[aTweet].user.screen_name,
				user_location: tweets[aTweet].user.location,
				user_followers_count: tweets[aTweet].user.followers_count,
				user_friends_count: tweets[aTweet].user.friends_count,
				user_created_at: tweets[aTweet].user.created_at,
				user_time_zone: tweets[aTweet].user.time_zone,
				user_profile_background_color: tweets[aTweet].user.profile_background_color,
				user_profile_image_url: tweets[aTweet].user.profile_image_url,
				geo: tweets[aTweet].geo,
				coordinates: tweets[aTweet].coordinates,
				place: tweets[aTweet].place
			}
			parsedTweets.push(parsed);
		}

		//https://www.npmjs.com/package/jsonexport
		jsonexport(parsedTweets, function(err, csv) {
		   if(err) return console.log(err);
			fs.writeFile("wangm13-tweets.csv", csv);
		});			
		res.send(tweets);
	}
});`

In the csv file, some of the text fields with newlines are correctly surrounded with quotes (for example on line 46: "RT @LToddWood: Judge Napolitano Returns On Fox News, Stands By Claim Brits Spied On Trump

https://t.co/Bumb2HG8eI"). However, some are not.

Examples:

Line 6
RT @TLBJames: This is EXACTLY the bigoted-GOP-emboldening I knew Trump's coup-by-EC-victory would cause.

And EXACTLY why we're g…

Line 35
Please stop this.

cc @SenMarkey @SenWarren @RepKClark https://t.co/LStc6p6TmW

@kaue kaue assigned kaue and unassigned kaue Jun 2, 2017
@kaue kaue added the bug label Jun 2, 2017
@kaue
Copy link
Owner

kaue commented Jun 5, 2017

@mwang25277 This should be fixed in v2.0.0, i will close the issue after it's published.

@kaue kaue mentioned this issue Jun 6, 2017
@kaue kaue closed this as completed Jun 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants