/tech/ - Technology and Computing

Technology, computing, and related topics (like anime)

I Fucked Up

Max message length: 6144

Drag files to upload or
click here to select them

Maximum 5 files / Maximum size: 20.00 MB

More

(used to delete files and postings)


Post Notifier Anonymous 03/16/2024 (Sat) 19:45:17 No.3519
I'm looking for a way to get notifications when posts are made on all my favorite imageboards as a way to A) Discourage myself from spending hours aimlessly lurking dozens of sites and finding maybe one or two new posts, while I have stuff I really should be doing. And B) Encourage activity on these places by being able to respond promptly. I want these notifications delivered to my phone, because I spend most of my time outside. I know /whitelist/ on Junkuchan has an RSS and an Atom feed, but I don't think most boards do. If there's some app that already does this that would be cool, but it needs to work for any IB. I've tried out some IB browsers but they only work on a handful of boards, and never the ones I actually use, and with the current state of IBs to rely solely on some guy, who's probably knee-deep in a computer science major, and working on 6 other projects, to learn about every new IB I like and get it on their app doesn't seem practical. And besides, I don't need a IB browser, just something that notifies me when a post is made. If this is something I'd have to make myself, I'm willing to do that, and if so, I'd love to be pointed in the right direction(s). I'm not particularly learned on computers or programming, but I've always been able to mash out anything that I set my mind to.
>>3519 >>3519 You could do this yourself by scraping the catalogs of the boards you care about. It's pretty easy, the only problem is different sites will be slightly different so you'll have to tweak the code for each one. That's why the apps you've tried don't work for every IB. I'll show you how you could do this site as an example though. Load up the catalog ( https://alogs.space/tech/catalog.html ) and either use Inspect Element or look at the page source to see how the html is laid out for the posts. On this site each post has a div container with the class "catalogCell". The cell for your post looks like this: <div class="catalogCell"> <a class="linkThumb" data-filemime="image/jpeg" href="/tech/res/3519.html"><img loading="lazy" src="/.media/t_521cc4fa7782f2124436653ee6b072f1f70c4de3df51c0ce23fb44cfcafa6d3f"></a> <p class="threadStats"> R: <span class="labelReplies">0</span> / I: <span class="labelImages">0</span> / P: <span class="labelPage">1</span> </p> <p> <span class="labelSubject">Post Notifier</span> </p> <div class="divMessage">I'm looking for a way to get notifications when posts are made on all my favorite imageboards as a way to...</div> </div> The information you need is the link to the post (<a>, href value) and the reply count (<span>, text value). Luckily within the div these are the first elements of their kind so the code is even simpler (you can use find instead of find_all and sorting). I'll show you how to do it in Python with Requests and BeautifulSoup. You'll have to figure out getting those installed on your computer but it's not that hard. In your script you'd have import requests from bs4 import BeautifulSoup html_data = requests.get("https://alogs.space/tech/catalog.html") soup = BeautifulSoup(html_data.content) cell_data = soup.find_all("div", {"class":"catalogCell"}) threads = {} for cell in cell_data: link = cell.find("a")['href'] reply_count = cell.find("span").text threads[link] = reply_count this gives you a set of key/value pairs called threads with the links and reply counts of each thread. I won't post all 132 points but here are the first 3: {'/tech/res/2493.html': '36', '/tech/res/4.html': '0', '/tech/res/3519.html': '0', ... } Now you could save this to a file and run the program again later or just keep the script alive and the data in memory. After I make this post if I were to run the script again I'd get: {'/tech/res/2493.html': '36', '/tech/res/4.html': '0', '/tech/res/3519.html': '1', ... } Either way, all you have to do is compare the new set to the previous set and pick out any changed values. Say you named your new data set threads2. You could just use: for key in threads2.keys(): if threads2[key] != threads[key]: print(key) To show you which threads had received a new post. How to run this and how to get the information from the script to you (notification) could be done in a lot of different ways so I won't go into that. I hope this gives you a good outline of how you'd do it though. It's not really that hard. You don't need to know much about programming really, it might be a good way to start learning.

Report/Delete/Moderation Forms
Delete
Report