dariusk / NaNoGenMo-2015

National Novel Generation Month, 2015 edition.
340 stars 21 forks source link

Twitter Novel Generator, one day at a time! #56

Open MartinPetkov opened 9 years ago

MartinPetkov commented 9 years ago

My idea is to write code that runs each day and gets the most trending topic of the day before, then tries to construct a diary entry based on random tweets from that topic. In the end it should build a novel that tracks the online world over the course of the month.

hugovk commented 9 years ago

Sounds good.

Here's something that used Twitter in a different way last year. https://github.com/dariusk/NaNoGenMo-2014/issues/88

Once you have a topic, this command line/Python tool may be useful for collecting tweets in bulk. https://github.com/edsu/twarc

MartinPetkov commented 8 years ago

Completed! It's different now, it scrapes data for the past d days (configurable) and generates a novel like that, based on the trending topics for that day. Here's a link to the source code, along with one of the novels I generated: https://github.com/MartinPetkov/NaNoGenMo/tree/master/NaNoGenMo-2015

hugovk commented 8 years ago

Congratulations, have a completed label! I've also re-opened it so people can find this more easily.


I like the different mix of languages, especially starting with RTL Arabic.

(It'd be nice if you could wrap the text at 80 columns or something, as it goes off the screen with GitHub.)

cpressey commented 8 years ago

(It'd be nice if you could wrap the text at 80 columns or something, as it goes off the screen with GitHub.)

You can click the "Raw" button, or paste the URL into https://rawgit.com/ , and the file will be served as plain text, which web browsers will usually display with word-wrapping.

hugovk commented 8 years ago

The "Raw" button and rawgit.com doesn't help much: they remove all the borders and margins and screen furniture, but the text still goes off the right-end of the screen.

Oh but: I've just checked some other browsers, and this happens in Chrome, Opera and IE, but Firefox auto-wraps it.

cpressey commented 8 years ago

Oh, is it only Firefox that does word-wrapping? Sorry, I thought for some reason that the majority of browsers worked that way... guess not.

Maybe someone can write a clever bookmarklet that injects the right CSS in the right place to cause plain text files on GitHub to word-wrap.

Or, another thing that can be done is to give the text file a .md extension and hope it looks reasonable as Markdown. A lot of text files will, even if they weren't intentionally written as Markdown, and Markdown will word-wrap nicely when displayed on GitHub. But, this is something the committer of the file has to do.

MartinPetkov commented 8 years ago

I tried it with md, and it looks atrocious, much worse than the .txt.

The reason it includes worldwide topics is that I couldn't find access to a resource with historic Twitter trends for any other WOEID than "World" and "Turkey," and "World" seemed more interesting and universal. I also only spent about a day working on this, since I didn't have time the rest of the month, so it is what it is.

hugovk commented 8 years ago

For future reference, here's 10 months of (mostly) UK and US Twitter trends, one logged per hour:

https://gist.github.com/hugovk/17d6c0e8897237deec87

(These were logged by https://twitter.com/botschmot to make sure it doesn't repeat itself.)

But I agree, worldwide is good here.

enkiv2 commented 8 years ago

Generally speaking, if you replace all real newlines with double-newlines and rename to .md, github will format it correctly as word-wrapped text, so long as you don't accidentally trigger style markup.

On Mon, Nov 30, 2015 at 1:14 PM Hugo notifications@github.com wrote:

For future reference, here's 10 months of (mostly) UK and US Twitter trends, one logged per hour:

https://gist.github.com/hugovk/17d6c0e8897237deec87

(These were logged by https://twitter.com/botschmot to make sure it doesn't repeat itself.)

But I agree, worldwide is good here.

— Reply to this email directly or view it on GitHub https://github.com/dariusk/NaNoGenMo-2015/issues/56#issuecomment-160710881 .