Skip to content

Instantly share code, notes, and snippets.

@linusheck
Created February 18, 2018 13:21
Show Gist options
  • Save linusheck/ab4dadd3983da5351632f8b179dfc787 to your computer and use it in GitHub Desktop.
Save linusheck/ab4dadd3983da5351632f8b179dfc787 to your computer and use it in GitHub Desktop.
import json
import urllib.request
def get_ratio(subreddit):
url = "https://www.reddit.com/r/" + subreddit + "/top/.json?sort=top&t=all&from="
total_upvotes = 0
total_comments = 0
for i in range(0, 200, 25):
open_url = url + str(i)
returned_data = None
req = urllib.request.Request(
open_url,
headers = {
"user-Agent": "votes-to-comments-bot"
}
)
with urllib.request.urlopen(req) as response:
returned_data = response.read()
data = json.loads(returned_data)
for post in data["data"]["children"]:
post_data = post["data"]
total_upvotes += post_data["score"]
total_comments += post_data["num_comments"]
if total_comments == 0:
return 0
return total_upvotes / total_comments
ratios = []
subs = ['announcements', 'funny', 'AskReddit', 'todayilearned', 'science', 'worldnews', 'pics', 'IAmA', 'gaming', 'videos', 'movies', 'aww', 'Music', 'blog', 'gifs', 'news', 'explainlikeimfive', 'askscience', 'EarthPorn', 'books', 'television', 'mildlyinteresting', 'LifeProTips', 'Showerthoughts', 'space', 'DIY', 'Jokes', 'gadgets', 'nottheonion', 'sports', 'tifu', 'food', 'photoshopbattles', 'Documentaries', 'InternetIsBeautiful', 'Futurology', 'history', 'dataisbeautiful', 'UpliftingNews', 'listentothis', 'GetMotivated', 'personalfinance', 'OldSchoolCool', 'philosophy', 'Art', 'nosleep', 'WritingPrompts', 'creepy', 'TwoXChromosomes', 'Fitness', 'technology', 'WTF', 'bestof', 'AdviceAnimals', 'politics', 'atheism', 'interestingasfuck', 'europe', 'woahdude', 'BlackPeopleTwitter', 'oddlysatisfying', 'gonewild', 'leagueoflegends', 'pcmasterrace', 'reactiongifs', 'gameofthrones', 'wholesomememes', 'Unexpected', 'Overwatch', 'facepalm', 'trees', 'Android', 'lifehacks', 'me_irl', 'relationships', 'Games', 'nba', 'programming', 'tattoos', 'NatureIsFuckingLit', 'Whatcouldgowrong', 'CrappyDesign', 'dankmemes', 'nsfw', 'cringepics', '4chan', 'soccer', 'comics', 'sex', 'pokemon', 'malefashionadvice', 'NSFW_GIF', 'StarWars', 'Frugal', 'RealGirls', 'HistoryPorn', 'AnimalsBeingJerks', 'travel', 'buildapc', 'OutOfTheLoop101', 'memes', 'FoodPorn', 'fffffffuuuuuuuuuuuu', 'mildlyinfuriating', 'GifRecipes', 'Tinder', 'reddit.com', 'PS4', 'pokemongo', 'loseit', 'ImGoingToHellForThis', 'YouShouldKnow', 'nfl', 'Bitcoin', 'Eyebleach', 'rickandmorty', 'RoastMe', 'instant_regret', 'AnimalsBeingBros', 'wheredidthesodago', 'AskHistorians', 'hiphopheads', 'cringe', 'HighQualityGifs', 'nonononoyes', 'trippinthroughtime', 'FiftyFifty', 'RoomPorn', 'Cooking', 'xboxone', 'baseball', 'hearthstone', 'youtubehaiku', 'holdmybeer', 'anime', 'trashy', 'quityourbullshit', 'dadjokes', 'bodyweightfitness', 'EatCheapAndHealthy', 'GlobalOffensive', 'iamverysmart', 'cats', 'CryptoCurrency', 'apple', 'holdthemoan', 'conspiracy', 'itookapicture', 'scifi', 'hmmm', 'The_Donald', 'freebies', 'PeopleFuckingDying', 'Damnthatsinteresting', 'comicbooks', 'humor', 'Minecraft', 'pcgaming', 'thatHappened', 'streetwear', 'oldpeoplefacebook', 'boardgames', 'shittyaskscience', 'AbandonedPorn', 'woodworking', 'MovieDetails', 'BetterEveryLoop', 'howto', 'wow', 'spaceporn', 'changemyview', 'keto', 'reallifedoodles', 'NetflixBestOf', 'educationalgifs', 'hockey', 'JusticePorn', 'AskMen', 'GameDeals', 'DestinyTheGame', 'cars', 'photography', 'talesfromtechsupport', 'PUBATTLEGROUNDS', 'learnprogramming', 'slowcooking', 'BustyPetite', 'nevertellmetheodds', 'AskWomen', 'investing', 'Wellthatsucks', 'rarepuppers', 'MakeupAddiction', 'MadeMeSmile', 'NintendoSwitch', 'iphone', 'MealPrepSunday', 'skyrim', 'frugalmalefashion', 'PerfectTiming', 'Steam', 'PrequelMemes', 'gardening', 'MMA', 'gentlemanboners', 'recipes', 'battlestations', 'ChildrenFallingOver', 'nsfw_gifs', 'madlads', 'ProgrammerHumor', 'therewasanattempt', 'offmychest', 'thewalkingdead', 'wallpapers', 'SkincareAddiction', 'natureismetal', 'FanTheories', 'relationship_advice', 'firstworldanarchists', 'DunderMifflin', 'blackmagicfuckery', 'nintendo', 'HumansBeingBros', 'NoStupidQuestions', 'geek', 'Economics', 'BeAmazed', 'BikiniBottomTwitter', 'whatisthisthing', 'MemeEconomy', 'DnD', 'MapPorn', 'asoiaf', 'ATBGE', 'Amateur', 'urbanexploration', 'dogs', 'KenM', 'TalesFromRetail', 'GamePhysics', 'nononono', 'insanepeoplefacebook', 'OSHA', 'DotA2', 'LearnUselessTalents', 'BuyItForLife', 'olympics', 'ContagiousLaughter', 'confession', 'femalefashionadvice', 'TrueReddit', 'math', 'cumsluts', 'shutupandtakemymoney', 'harrypotter', 'UNBGBBIIVCHIDCTIICBG', 'meirl', 'polandball', 'TumblrInAction', 'AnimalsBeingDerps', 'starterpacks', 'business', 'Roadcam', 'entertainment', 'running', 'Fallout', 'youseeingthisshit', 'thisismylifenow', 'Drugs', 'Entrepreneur', 'electronicmusic', 'environment', 'motorcycles', 'RocketLeague', 'savedyouaclick', 'wallpaper', 'PetiteGoneWild', 'writing', 'Awwducational', 'CampingandHiking', 'pettyrevenge', 'ProRevenge', 'raspberry_pi', 'niceguys', 'babyelephantgifs', 'MurderedByWords', 'GirlsFinishingTheJob', 'Justrolledintotheshop', 'CFB', 'QuotesPorn', 'guns', 'ArtisanVideos', 'offbeat', 'Guitar', 'CozyPlaces', 'legaladvice', 'ass', 'westworld', 'ExpectationVsReality301', 'outside', 'StartledCats', 'financialindependence', 'shittyfoodporn', 'breakingbad', 'whitepeoplegifs', 'psychology', 'DoesAnybodyElse', 'AccidentalRenaissance', 'Sneakers', 'calvinandhobbes', 'nostalgia', 'everymanshouldknow', 'OopsDidntMeanTo', 'chemicalreactiongifs', 'buildapcsales', 'h3h3productions', 'youdontsurf', 'teenagers', 'canada', 'standupshots', 'WhitePeopleTwitter', 'TrollXChromosomes', 'IdiotsFightingThings', 'UnethicalLifeProTips', 'blunderyears', 'coolguides', 'AsiansGoneWild', 'carporn', 'justneckbeardthings', 'ANormalDayInRussia', 'UnresolvedMysteries', 'beer', 'SubredditDrama', 'evilbuildings', 'baconreader', 'porninfifteenseconds', 'depression', 'MaliciousCompliance', 'ColorizedHistory', 'DeepIntoYouTube', 'ethereum', 'PoliticalHumor', 'CasualConversation', 'milf', 'ofcoursethatsathing', 'CringeAnarchy', 'progresspics', 'LetsNotMeet', 'bodybuilding', 'LegalTeens', 'SquaredCircle', 'freefolk', 'southpark', 'ShittyLifeProTips', 'Celebs', 'rule34', 'IASIP', 'tipofmytongue', 'zelda', 'backpacking', 'watchpeopledie', 'adorableporn', 'JusticeServed', 'OnOff', 'INEEEEDIT', 'CrazyIdeas', 'CityPorn', 'socialskills', 'PenmanshipPorn', 'Cinemagraphs', 'DesignPorn', 'HomeImprovement', 'tumblr', 'de_IAmA', 'Boobies', 'fantasyfootball', 'creepyPMs', 'corgi', 'FellowKids', 'Rainbow6', 'beta', 'jailbreak', 'IWantToLearn', 'Marvel', 'circlejerk', 'lego', 'web_design', 'shittyrobots', 'StrangerThings', 'NoFap', 'Astronomy', 'formula1', 'WatchItForThePlot', 'Justfuckmyshitup', 'BiggerThanYouThought', 'HappyEmbarrassedGirls', 'PublicFreakout', 'doctorwho', 'DiWHY401', 'linux', '60fpsporn', 'getdisciplined', '2meirl4meirl', 'theydidthemath', 'DepthHub', 'homemadexxx', 'minimalism', 'Physics', 'horror', 'vinyl', 'NSFWFunny', 'futurama', 'Twitch', 'iamverybadass', 'greentext', 'NSFW_Snapchat', 'dirtysmall', 'ThriftStoreHauls', 'sadcringe', 'Design', 'hacking', 'kpop', 'SweatyPalms', 'NotMyJob', 'pawg', 'blackpeoplegifs', 'MorbidReality', 'Shitty_Car_Mods', 'girlsinyogapants', 'worldpolitics', 'seduction', 'TheSilphRoad', 'Meditation', 'CatastrophicFailure', 'marvelstudios', 'foodhacks', 'LipsThatGrip', 'mechanical_gifs', 'howtonotgiveafuck', 'TittyDrop', 'celebnsfw', 'assholedesign', 'nsfwhardcore', 'combinedgifs', 'boottoobig', 'Fantasy', 'LateStageCapitalism', 'holdmycosmo', 'indianpeoplefacebook', 'Bundesliga', 'gonewildcurvy', 'collegesluts', 'cosplaygirls', 'WhyWereTheyFilming', 'smashbros', 'WeAreTheMusicMakers', 'MURICA', 'TheRedPill', 'shittyreactiongifs', 'graphic_design', 'StoppedWorking', 'MechanicalKeyboards', 'Parenting', 'xxfitness', 'gamedev', 'totallynotrobots', 'surrealmemes', 'Watches', 'netflix', 'fullmoviesonyoutube', 'ScottishPeopleTwitter', 'bicycling', 'startups', 'techsupportgore', 'Filmmakers', 'WeWantPlates', 'worldbuilding', 'thalassophobia', 'likeus', 'asstastic', 'drawing', 'netsec', 'softwaregore', 'Pareidolia', 'beermoney', 'ChoosingBeggars', 'DadReflexes', 'AMA', 'Blowjobs', 'dankchristianmemes', 'magicTCG', 'SubredditSimulator', 'FloridaMan', 'manga', 'fo4', 'powerwashingporn', 'subredditoftheday', 'WatchPeopleDieInside', 'Health']
for s in subs:
try:
t = (s, get_ratio(s))
print(t)
ratios.append(t)
except:
print("Crashed for ", s)
print(sorted(ratios, key=lambda x: x[1]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment