User:Lidia.Pereira/PNM/Fluffying: Difference between revisions
< User:Lidia.Pereira | PNM
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
Replacing "fucking" with fluffy verbs on the comments for the Top Rated YouTube videos. | |||
http://greenbuda.files.wordpress.com/2012/02/only-you-can-stop-cyber-bullying.gif | |||
<syntaxhighlight lang="python"> | <syntaxhighlight lang="python"> | ||
Line 11: | Line 13: | ||
topRated = data['data'] ['items'] | topRated = data['data'] ['items'] | ||
fluffyVerbs = ["baking","combing","cuddling","babysitting","fluffing","braiding"] | |||
for i in topRated: | for i in topRated: | ||
print i[' | print i['title'] | ||
url = "http://gdata.youtube.com/feeds/api/videos/"+i['id']+"/comments?alt=json" | url = "http://gdata.youtube.com/feeds/api/videos/"+i['id']+"/comments?alt=json" | ||
feed2 = urllib2.urlopen(url) #it stores the generated url into this new feed variable | feed2 = urllib2.urlopen(url) #it stores the generated url into this new feed variable | ||
data2 = json.load(feed2) | data2 = json.load(feed2) #it loads feed2 | ||
for c in data2 ['feed']['entry']: | for c in data2 ['feed']['entry']: #this nested loop will put my generated url's into use | ||
content = c['content']['$t'] | content = c['content']['$t'] | ||
print content.replace("fucking", | if "fucking" in content: | ||
print content.replace("fucking",fluffyVerbs[random.randint(0,5)]) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
-- | |||
Here are some of my favourites: | |||
''Evolution of Dance - By Judson Laipply'' | |||
he babysitting rocks the robot dance omg | |||
''Jeff Dunham - Achmed the Dead Terrorist'' | |||
If you want to see her babysitting check out : rihanna-new-sextape.eu.pn | |||
''Nicki Minaj - Super Bass'' | |||
The girl was baking a black NBA player. | |||
To do next: | |||
Add more innapropriate words to a list and replace them with innocuous ones. |
Revision as of 15:01, 27 September 2013
Replacing "fucking" with fluffy verbs on the comments for the Top Rated YouTube videos.
import urllib2
import json
import random
feed = urllib2.urlopen("http://gdata.youtube.com/feeds/api/standardfeeds/top_rated?v=2&alt=jsonc")
data = json.load(feed)
topRated = data['data'] ['items']
fluffyVerbs = ["baking","combing","cuddling","babysitting","fluffing","braiding"]
for i in topRated:
print i['title']
url = "http://gdata.youtube.com/feeds/api/videos/"+i['id']+"/comments?alt=json"
feed2 = urllib2.urlopen(url) #it stores the generated url into this new feed variable
data2 = json.load(feed2) #it loads feed2
for c in data2 ['feed']['entry']: #this nested loop will put my generated url's into use
content = c['content']['$t']
if "fucking" in content:
print content.replace("fucking",fluffyVerbs[random.randint(0,5)])
Here are some of my favourites:
Evolution of Dance - By Judson Laipply he babysitting rocks the robot dance omg
Jeff Dunham - Achmed the Dead Terrorist If you want to see her babysitting check out : rihanna-new-sextape.eu.pn
Nicki Minaj - Super Bass The girl was baking a black NBA player.
To do next: Add more innapropriate words to a list and replace them with innocuous ones.