ruby-upworthy 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +7 -0
  2. data/bin/upworthy +5 -0
  3. data/lib/upworthy.rb +403 -0
  4. metadata +47 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 67af31fdace5cef2179bb7e12785d741b662b3a9
4
+ data.tar.gz: 7d7882eb4b1aba6328fe77231637959b35427ad8
5
+ SHA512:
6
+ metadata.gz: aefaca8e5af828db70d689f3830794e47fad9548eeca818cf4bb2ec9c3b7122f7d264fcef86f571f61c5e6fe5d48164f7e6dfe622f4a6fa0265075a13dee5cec
7
+ data.tar.gz: 8201c9749899a14ee76364994697f8e74788177c77afaaf91969195d4b4b1cd481c603136229e0bbbb80f8c754bae61a132103b3aae2d221585dae3e03041836
data/bin/upworthy ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'upworthy'
4
+
5
+ puts Upworthy.headline
data/lib/upworthy.rb ADDED
@@ -0,0 +1,403 @@
1
+ # upworthy.rb
2
+ # Author: William Woodruff
3
+ # A Ruby translation of Mike Lacher's Upworthy Generator
4
+ # Translated from http://www.upworthygenerator.com/upworthy.js
5
+
6
+ # Namespace for constants and methods needed to generate headlines.
7
+ # @author William Woodruff
8
+ # @since 0.0.1
9
+ module Upworthy
10
+ # @private
11
+ HEADLINES = [
12
+ "You %{imploreaudio} the %{creationadjective} %{creationaudio} this %{actoradjective} %{actor} %{createdsynonym}",
13
+ "You %{implorevisual} the %{creationadjective} %{creationvisual} this %{actoradjective} %{actor} %{createdsynonym}",
14
+ "Here is what happens when a %{actor} %{action}",
15
+ "That moment when a %{actor} %{action}",
16
+ "I wish I was more %{pasttenseshocked} by what a %{actoradjective} %{actor} %{revealed}, but I'm not",
17
+ "What happens when one %{actoradjective} %{actor} %{action}",
18
+ "Try not to %{yourreaction} when you %{verbaudio} %{audiofragmentwitharticle}",
19
+ "You will %{yourreaction} when you see what a %{actoradjective} %{actor} %{createdsynonym}",
20
+ "Think %{preconception}? Maybe you should listen to this %{actoradjective} %{actor}",
21
+ "Some call it %{positivethingwitharticle}. They call it %{negativethingwitharticle}",
22
+ "I thought it was %{negativethingwitharticle}. But then I saw this %{creationadjective} %{creationvisual}",
23
+ "I'll never look at this %{actoradjective} %{actor} the same way again",
24
+ "If you can watch this and not feel %{pasttenseshocked}, then %{youremadeofstone}",
25
+ "What this %{actoradjective} %{actor} did is genius",
26
+ "Listen to %{audiofragmentwitharticle} and try to tell me %{preconception}",
27
+ "Watch a %{actoradjective} %{actor} become a %{greatperson} with %{creationaudio}",
28
+ "Before you say %{preconception}, listen to %{audiofragmentwitharticle} from a %{actor}",
29
+ "My %{jawhitthefloor} after hearing %{audiofragmentwitharticle}"
30
+ ]
31
+
32
+ # @private
33
+ CONTENT = {
34
+ jawhitthefloor: [
35
+ "jaw hit the floor",
36
+ "heart broke",
37
+ "head hurt",
38
+ "heart is breaking",
39
+ "brain exploded",
40
+ "stomach sank",
41
+ "tears keep flowing",
42
+ "faith in humanity shattered",
43
+ "hope for the world plummeted",
44
+ "faith in humanity soared",
45
+ "confidence in the next generation is stronger than ever",
46
+ "disgust hit new lows"
47
+ ],
48
+
49
+ greatperson: [
50
+ "hero",
51
+ "inspiration",
52
+ "role model",
53
+ "legend"
54
+ ],
55
+
56
+ youremadeofstone: [
57
+ "you're made of stone",
58
+ "you have no emotions",
59
+ "you are stronger than I am",
60
+ "you are made of ice",
61
+ "you have a heart of coal"
62
+ ],
63
+
64
+ positivethingwitharticle: [
65
+ "the solution to world peace",
66
+ "just another day",
67
+ "the miracle of life",
68
+ "the key to happiness",
69
+ "a miracle",
70
+ "a godsend",
71
+ "the greatest thing that's ever happened",
72
+ "the solution to climate change",
73
+ "the answer to all our prayers",
74
+ "what we've been waiting for",
75
+ "the answer to world hunger",
76
+ "the cure for childhood obesity",
77
+ "a miracle drug",
78
+ "a masterpiece",
79
+ "the end of polio",
80
+ "the cure for cancer",
81
+ "the key to peace in the Middle East",
82
+ "the end of all wars",
83
+ "a victory against homophobia",
84
+ "the end of racism"
85
+ ],
86
+
87
+ negativethingwitharticle: [
88
+ "an inescapable curse",
89
+ "a living nightmare",
90
+ "the worst-case scenario",
91
+ "the world's greatest tragedy",
92
+ "a killer of children",
93
+ "a travesty",
94
+ "a menace to equality",
95
+ "a homophobic nightmare",
96
+ "education's enemy",
97
+ "a deadly poison",
98
+ "a silent genocide",
99
+ "the worst kind of discrimination",
100
+ "an ecological disaster",
101
+ "a disaster",
102
+ "a threat to all of us"
103
+ ],
104
+
105
+ preconception: [
106
+ "discrimination is over",
107
+ "America is the best country",
108
+ "Africa is getting better",
109
+ "partisian politics are killing America",
110
+ "we're winning the war on terror",
111
+ "the economy is better",
112
+ "America's disparity in income is all bad",
113
+ "babies can't be racist",
114
+ "there aren't pedophiles in your neighborhood",
115
+ "things are better than they used to be",
116
+ "things used to be better when you were a kid",
117
+ "polio isn't a threat in the US",
118
+ "you're not racist",
119
+ "you're not homophobic",
120
+ "you've never discriminated against someone",
121
+ "you're not a misogynist",
122
+ "homophobia is on the decline",
123
+ "babies can't be homophobic",
124
+ "computers made the world a better place",
125
+ "you're not addicted to your cell phone",
126
+ "we're not in a housing bubble",
127
+ "you have job security",
128
+ "you could never die in a fire"
129
+ ],
130
+
131
+ yourreaction: [
132
+ "let your jaw hit the floor",
133
+ "gasp",
134
+ "get angry",
135
+ "lose your breath",
136
+ "cry",
137
+ "weep",
138
+ "scream",
139
+ "dig your fingernails into your desk",
140
+ "punch your monitor",
141
+ "do a double take",
142
+ "shout with rage",
143
+ "groan",
144
+ "roll your eyes",
145
+ "get upset",
146
+ "be mortified",
147
+ "rage"
148
+ ],
149
+
150
+ verbaudio: [
151
+ "hear",
152
+ "listen to"
153
+ ],
154
+
155
+ audiofragmentwitharticle: [
156
+ "this one word",
157
+ "these two sentences",
158
+ "these six words",
159
+ "this one statement",
160
+ "this one sentence",
161
+ "this one question",
162
+ "these two questions",
163
+ "these five words",
164
+ "this one declaration",
165
+ "these two words",
166
+ "the second half of the third sentence",
167
+ "the fifth and seventh words",
168
+ "the first word and the last word",
169
+ "the second sentence",
170
+ "these twelve words",
171
+ "this battlecry",
172
+ "these five nouns",
173
+ "this one verb",
174
+ "the eighth word",
175
+ "the first word and the second sentence",
176
+ "the third question",
177
+ "these nine words",
178
+ "the last sentence"
179
+ ],
180
+
181
+ pasttenseshocked: [
182
+ "surprised",
183
+ "revolted",
184
+ "outraged",
185
+ "disgusted",
186
+ "depressed"
187
+ ],
188
+
189
+ revealed: [
190
+ "revealed",
191
+ "exposed",
192
+ "documented",
193
+ "proved",
194
+ "publicized"
195
+ ],
196
+
197
+ imploreaudio: [
198
+ "won't believe",
199
+ "have to hear",
200
+ "don't want to have to think about",
201
+ "should really think about listening to",
202
+ "don't want to hear",
203
+ "absolutely have to listen to",
204
+ "won't really understand what's happening in the world until you hear",
205
+ "need to drop everything and hear",
206
+ "can't imagine",
207
+ "can't fathom",
208
+ "can't begin to understand"
209
+ ],
210
+
211
+ implorevisual: [
212
+ "won't believe",
213
+ "need to see",
214
+ "should really think about watching",
215
+ "can't imagine",
216
+ "can't fathom",
217
+ "can't begin to understand"
218
+ ],
219
+
220
+ creationvisual: [
221
+ "short film",
222
+ "music video",
223
+ "twenty second video",
224
+ "ten second video",
225
+ "vlog",
226
+ "one minute video",
227
+ "fifty second video",
228
+ "forty second video"
229
+ ],
230
+
231
+ creationaudio: [
232
+ "one word",
233
+ "two sentences",
234
+ "three sentences",
235
+ "five words",
236
+ "two words",
237
+ "three words",
238
+ "four words",
239
+ "three sentences",
240
+ "one question",
241
+ "one declaration",
242
+ "six words",
243
+ "ten words",
244
+ "two words and a question"
245
+ ],
246
+
247
+ creationadjective: [
248
+ "hilarious",
249
+ "mindblowing",
250
+ "scarily-accurate",
251
+ "heartwrenching",
252
+ "tearjerking",
253
+ "saddening",
254
+ "shocking",
255
+ "amazing",
256
+ "awe-inspiring",
257
+ "troubling",
258
+ "jaw-dropping",
259
+ "brain-exploding",
260
+ "tear-inducing",
261
+ "outrageous",
262
+ "pioneering",
263
+ "revolutionary",
264
+ "ridiculous",
265
+ "sobering"
266
+ ],
267
+
268
+ actor: [
269
+ "new mom",
270
+ "seventh-grader",
271
+ "physicist",
272
+ "bullied teen",
273
+ "science teacher",
274
+ "eight year-old",
275
+ "man",
276
+ "woman",
277
+ "comedian",
278
+ "former model",
279
+ "single dad",
280
+ "former drug addict",
281
+ "veteran",
282
+ "Holocaust survivor",
283
+ "trailblazer",
284
+ "mother of three",
285
+ "LGBT activist",
286
+ "NBA coach",
287
+ "converted racist",
288
+ "former klansman",
289
+ "witness to a murder",
290
+ "tween",
291
+ "high schooler",
292
+ "cheerleader",
293
+ "late night host",
294
+ "teacher",
295
+ "actor",
296
+ "oscar winner",
297
+ "millennial",
298
+ "doctor",
299
+ "talk show host",
300
+ "actress",
301
+ "stand-up comedian",
302
+ "child star",
303
+ "beauty queen",
304
+ "model",
305
+ "blogger",
306
+ "mommy blogger",
307
+ "criminologist",
308
+ "sociologist",
309
+ "cancer survivor",
310
+ "cancer patient",
311
+ "father of three",
312
+ "teacher",
313
+ "kindergartener",
314
+ "author",
315
+ "poet",
316
+ "teenager",
317
+ "criminal",
318
+ "convict",
319
+ "police officer",
320
+ "plastic surgeon",
321
+ "mayor",
322
+ "city councilman",
323
+ "senator",
324
+ "animal rights activist",
325
+ "community organizer",
326
+ "music teacher",
327
+ "pianist",
328
+ "director",
329
+ "fashonista"
330
+ ],
331
+
332
+ actoradjective: [
333
+ "homeless",
334
+ "bullied",
335
+ "disgraced",
336
+ "trailblazing",
337
+ "transgender",
338
+ "fearless",
339
+ "introverted",
340
+ "legendary",
341
+ "forgotten",
342
+ "iconic",
343
+ "disabled",
344
+ "blind",
345
+ "autistic",
346
+ "gay",
347
+ "queer",
348
+ "famous",
349
+ "extroverted",
350
+ "angry",
351
+ "nostalgic",
352
+ "slandered",
353
+ "iconoclastic",
354
+ "outraged",
355
+ "unstoppable",
356
+ "barrier-smashing",
357
+ "unknown",
358
+ "inspiring",
359
+ "",
360
+ "",
361
+ ""
362
+ ],
363
+
364
+ action: [
365
+ "won't give up",
366
+ "doesn't take no for an answer",
367
+ "says what none of us will",
368
+ "lays it all out",
369
+ "talks about the elephant in the room",
370
+ "gets real about the biggest problem in America",
371
+ "refuses to be silent",
372
+ "starts a revolution",
373
+ "doesn't worry about what anyone thinks",
374
+ "stands up to the critics",
375
+ "doesn't accept bullying",
376
+ "throws political correctness out the window",
377
+ "says what we've all thought",
378
+ "speaks up for the voiceless",
379
+ "stands up for the people who can't",
380
+ "knows when it's time to make a stand",
381
+ "won't retreat"
382
+ ],
383
+
384
+ createdsynonym: [
385
+ "made",
386
+ "wrote",
387
+ "created",
388
+ "found",
389
+ "delighted the internet with",
390
+ "came up with"
391
+ ]
392
+ }
393
+
394
+ # Generates a new clickbait headline.
395
+ # @example
396
+ # Upworthy.headline # => "Watch an extroverted police officer become a legend with six words"
397
+ # @return [String] the headline
398
+ def self.headline
399
+ content = Hash[CONTENT.map { |k, v| [k, v.sample] }]
400
+
401
+ (HEADLINES.sample % content).gsub(' ', ' ')
402
+ end
403
+ end
metadata ADDED
@@ -0,0 +1,47 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ruby-upworthy
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - William Woodruff
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-08-07 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: A Ruby translation of http://www.upworthygenerator.com/.
14
+ email: william@tuffbizz.com
15
+ executables:
16
+ - upworthy
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - bin/upworthy
21
+ - lib/upworthy.rb
22
+ homepage: https://github.com/woodruffw/ruby-upworthy
23
+ licenses:
24
+ - MIT
25
+ metadata: {}
26
+ post_install_message:
27
+ rdoc_options: []
28
+ require_paths:
29
+ - lib
30
+ required_ruby_version: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: 1.9.0
35
+ required_rubygems_version: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ requirements: []
41
+ rubyforge_project:
42
+ rubygems_version: 2.4.5
43
+ signing_key:
44
+ specification_version: 4
45
+ summary: ruby-upworthy - Generate clickbait titles.
46
+ test_files: []
47
+ has_rdoc: