2023

Code Project: Automated List From Reddit Comments

This is one of those quick and kind of dirty projects I’ve been meaning to do for a while. Basically, I wanted a script that would scrape all of the top level comments from a Reddit post and push them out to a list. Most commonly, to use on /r/AskReddit style threads like, well, for this example, “What is a song from the 90s that young people should listen to.”

Basically, threads that ask for useful opinions on list. Sometimes it’s lists of websites or something. Often it’s music. The script here is made for music but could be adjusted for any thread. Here is the script, I’ll touch on it a bit in more detail after.

## Create an APP for Secrets here:
## https://www.reddit.com/prefs/apps

import praw

## Thread to scrape goes here, replace the one below
url = "https://www.reddit.com/r/Music/comments/10c4ki0/name_one_90s_song_kids_born_after_2000_should_add/"

## Fill in API Information here
reddit = praw.Reddit(
    client_id="",
    client_secret= "",
    user_agent= "script by u/", # Your Username, not really required though
    redirect_uri= "http://localhost:8080",
)


submission = reddit.submission(url=url)
submission.comments.replace_more(limit=0)
submission.comment_limit = 1

for x in submission.comments:
    with open("output.txt", mode="a", encoding="UTF-8") as file:
        if "-" in x.body:
            file.write(str(x.body)+"\n")
            # print(x.body)

The script uses praw, Python Reddit API Wrapper. A Library made for use in Python and the Reddit API. It requires free keys which can be gotten here: https://www.reddit.com/prefs/apps. Just create an app, the Client ID is a jumble of letters under the name, the secret is labeled. User Agent can be whatever really, but it’s meant to be informative.

The thread URL also needs filled in.

The script then pulls the thread data and pulls the top level comments.

I’m interested in text file lists mostly, though for the sake of music based lists, if I used Spotify, I might combine it with the Spotify Playlist maker from my 100 Days of Python course. Like I said before though, this script is made for pulling music suggestions, with this but of code:

        if "-" in x.body:
            file.write(str(x.body)+"\n")
            # print(x.body)

It’s simple, but if the comment contains a dash, as in “Taylor Swift – Shake it Off” or “ACDC – Back in Black”, it writes it to the file. Otherwise it discards it. There is a chance it means discarding some submissions, but this isn’t precision work so I’m OK with that to filter out the chaff. If I were looking for URLs or something, I might look for “http” in the comment. I could also eliminate the “if” statement and just have it write all the comments to a file.

Sunday 2023-01-15 – Link List

Blogging Intensifies Link List for Sunday 2023-01-15

22-Jun-2020 – How to search Google without using Google, the self-hosted way

Brief Summary: “Hello everyone!
Last week I was talking with a friend and he was complaining about how Google knows everything about us,
so I took the chance to recom”

13-Jan-2023 – Deep Rock Galactic sold 2.3 million copies last year and I’m not surprised – it’s awesome

Brief Summary: “Deep Rock Galactic is a game about a bunch of Dwarves going mining, and there’s lots of creepy-crawlies that want to get in the way. It seems to only “

13-Jan-2023 – TNT Won’t Air Final Season of SNOWPIERCER

Brief Summary: ”
The small screen bloodbath continues. Deadline reports that Season 4 of Snowpiercer, the final outing of TNT’s last scripted series, won’t air on the”

13-Jan-2023 – Final Fantasy 7 mod adds voice acting to original game

Brief Summary: ”
The original Final Fantasy 7 is now fully voice acted, thanks to a new mod by the Tsunamods community.

Available today, Echo-S 7 adds voice acting t”

14-Jan-2023 – Is Hasbro Slowly Choking The Collecting Communities?

Brief Summary: “Today I want to talk about Hasbro’s current business strategy. This is not about whether or not Hasbro will go down, they will not, but ever since Chr”

Thursday 2023-01-12 – Link List

Blogging Intensifies Link List for Thursday 2023-01-12

12-Jan-2023 – HBO Max Increases Monthly Subscriber Price from US$14.99 to US$15.99

Brief Summary: “New ad-free plan pricing starts on February 11”

12-Jan-2023 – [Epic Games] Divine Knockout (DKO), First Class Trouble, Gamedec (Free/100% off)

Brief Summary: “submitted by /u/AT1952 [link] [comments]”

11-Jan-2023 – [Humble Bundle] Wadjet Eye: Sixteen Years of Adventure! (pay at least €9.48 for Unavowed, Strangeland, Primordia, Shardlight, Technobabylon, Resonance and more)

Brief Summary: ” submitted by /u/lovecrafthp [link] [comments] “

12-Jan-2023 – GOG officially ends its Steam-import Connect service after years of inactivity

Brief Summary: ”
GOG’s Connect service, which let users grab a free copy of a game they already owned on Steam to add their GOG library, is officially no more.

Launc”

12-Jan-2023 – Legend of Zelda cartoon writers reveal D&D influences

Brief Summary: ”
I may be biased, but I really feel that 1989 was a great year (I am biased because it was the year I was born). But, aside from my arrival in the wor”

11-Jan-2023 – Last year was a disaster for PC games – here’s how things need to change

Brief Summary: ”
2022 was a rough year for PC ports. Between stuttering performance issues and infuriating user experience problems, I was almost broken as a reviewer”

11-Jan-2023 – NES The Legend of Zelda recreated in VR Doom mod

Brief Summary: ”
If you’ve ever wanted to fully immerse yourself in The Legend of Zelda now’s your chance as a modder has made the original NES game playable in VR.

11-Jan-2023 – ClassicPress Community Votes to Re-Fork WordPress

Brief Summary: “In December 2022, the ClassicPress community voted on whether to re-fork WordPress or continue on with the project as-is. As WordPress continues to ev”

12-Jan-2023 – Humble’s excellent Wadjet Eye bundle has 13 games for less than a tenner

Brief Summary: “Wadjet Eye Games are behind some of the greatest point and click adventures of the last two decades, and if you’ve been looking for an excuse to catch”

12-Jan-2023 – The Legend of Zelda: How Every Version of  Zelda Is Related

Brief Summary: “Despite its name, the Legend of Zelda series has historically focused on Link. Even though they share the same name, most Links in the franchise are a”

12-Jan-2023 – Mega Man-like side-scroller action game Super Alloy Ranger now on Linux

Brief Summary: “Enjoy games similar to Mega Man? Like running and gunning? Super Alloy Ranger looks interesting and they recently put up a Native Linux version too.”

Wednesday 2023-01-04 – Link List

Blogging Intensifies Link List for Wednesday 2023-01-04

04-Jan-2023 – Ghibli Bonsai Displays Come With Real Water Effects

Brief Summary: “Available in My Neighbour Totoro, Princess Mononoke, Spirited Away versions”

04-Jan-2023 – Studio Ghibli’s New Year Card Sees Miyazaki Drawing Totoro and Rabbit

Brief Summary: ”
People around the world have different New Year’s traditions, and one in Japan is the New Year’s card referred to as a nengajo. In the previous New Y”

04-Jan-2023 – Skrillex has shared a new single ‘Rumble’, featuring Fred Again.. & Flowdan

Brief Summary: “Skrillex has dropped his new single, ‘Rumble’.

The new cut features grime MC Flowdan and was created in collaboration with Fred again…, who firs”

04-Jan-2023 – Watch Billie Eilish’s cover of Ben Folds’ ‘Still’

Brief Summary: “Billie Eilish has released a cover of Ben Folds’ 2006 song ‘Still’ on her TikTok account.

The 51-second video sees Eilish performing the track on “

04-Jan-2023 – Calvin Harris has announced a new “immersive” gig on TikTok LIVE

Brief Summary: “Calvin Harris is set to debut his first ever virtual concert next Friday (13th January).

The show, which will be streamed live on his official Tik”

04-Jan-2023 – Twitter to relax curbs on political ads as revenues drop

Brief Summary: “Since Elon Musk’s takeover, advertisers have paused spending amid fears of a rise in divisive contentTwitter has said it will relax restrictions on po”

03-Jan-2023 – The Commodore Amiga Shmup Library Essentials

Brief Summary: “Presented by the_knives and Herr Schatten
Over the years, Racketboy has covered the shmup libraries of numerous consoles, including the Turbografx-16/”

Tuesday 2023-01-03 – Link List

Blogging Intensifies Link List for Tuesday 2023-01-03

22-Dec-2022 – TRON! Favorite Scenes from the 1982 Classic

Brief Summary: “We share our personal favorite scenes from TRON! Given how revolutionary this movie was, it was hard for each of us to choose just one!
When talented “

03-Jan-2023 – FCC’s Attempt To Finally Map Broadband Continues To Be A Hot Mess

Brief Summary: “We’ve noted for decades how, despite all the political lip service paid toward “bridging the digital divide,” the U.S. doesn’t actually have any idea “

03-Jan-2023 – AT&T’s predictions of the future (1993)

Brief Summary: “Comments”

03-Jan-2023 – Republicans fight over speaker of the House – but whoever wins, the party loses | Robert Reich

Brief Summary: “The Republican party has collapsed under its own contradictions, competing impulses and fear of the baseOn Tuesday, as Republicans in the US House of “

03-Jan-2023 – Fortnite returning to iOS devices teased by Epic Games CEO

Brief Summary: “In celebration of New Year’s, Epic Games CEO Tim Sweeney posted a tweet which seems to be hinting Fortnite’s return to iOS. The game was taken off the”

03-Jan-2023 – Cavetown has announced the inaugural benefit concert for his non-profit organisation This Is Home Project

Brief Summary: “Cavetown has announced the inaugural benefit concert for his non-profit organisation This Is Home Project.

The show is set to take place on 11th Ja”

03-Jan-2023 – Skrillex is teasing album, with a new single ‘Rumble’ featuring Fred again.. and Flowdan due this week

Brief Summary: “Skrillex fans have been eagerly awaiting a new album since his 2014 debut, ‘Recess’. Now it looks like their patience will be rewarded in 2023.

Th”

03-Jan-2023 – She-Hulk comic book writer defends Disney+ series, calls it comics accurate

Brief Summary: “The release of Marvel’s She-Hulk: Attorney at Law saw much fanfare, but the Disney+ series also saw some backlash as some fans criticized the series’ “

03-Jan-2023 – Ukrainian Refugees Find Work Subtitling Anime

Brief Summary: ”
Because of Vladimir Putin’s ordered invasion of Ukraine, many Ukrainians have fled the country, and some have evacuated to Japan. While the majority “

02-Jan-2023 – Taylor Swift is rumoured to be releasing ‘Speak Now (Taylor’s Version)’ before embarking on The Eras Tour

Brief Summary: “Rumours have serviced that Taylor Swift is preparing to drop her Taylor’s Version of her third album ‘Speak Now’ before her The Eras Tour kicks off th”