Comment on
[meta] Vote on the instance for the community (closed for voting)
Reply in thread
Comment on
[meta] Vote on the instance for the community (closed for voting)
Reply in thread
Comment on
[meta] Vote on the instance for the community (closed for voting)
Reply in thread
Comment on
After tonight's annual meetings, the majority of clubs in Norwegian football's two top divisions vote to get rid of VAR
I'm personally in favour VAR, never felt it was much of an obstruction while going to local games. Glad my club voted in favour ⚪🔵
Comment on
The only way to post on this new community: an incredible shitpost
What a way to kick off the new community 😅
Comment on
[Announcement] Community migration to [email protected]
Reply in thread
With this script, can you get the list of subcribers ?
I don't think the Lemmy API exposes the subscriber list of a community, you'll need access to the instance database.
What I did was checking every post for the last 365 days for user activity and store every user that have interacted with the community.
lemmy_session and lemmy_references are the same as for the LiveThreadBot (inside the src folder): https://gitlab.com/UlrikHD/lemmy-match-thread-bot
get_posts() may be missing from the lemmy_session.py file though
def get_posts(self, *, community: int | str | LemmyCommunity, sort: str = 'New', page: int = 1) -> dict[str, any]:
""" Gets the posts of a community.
:param community: The ID of the community to get the posts of, can also be a LemmyCommunity parseable
string/object.
:param sort: The sorting method of the posts, by default 'New'.
:param page: The page number of the posts, by default 1.
:return: The response JSON of the request as a dictionary.
"""
if isinstance(community, LemmyCommunity) or isinstance(community, str):
response: Final[requests.Response] = self.srv.get_posts(community_name=community, sort=sort, page=page,
limit=50)
else:
response: Final[requests.Response] = self.srv.get_posts(community_id=community, sort=sort, page=page,
limit=50)
if response.status_code != 200:
raise requests.exceptions.HTTPError(response.text)
return response.json()
Excuse the ugly code, it was written as a one-off
import os
import time
import datetime
from json import load, dump
import requests
from lemmy_references import LemmyCommunity, LemmyUser
from lemmy_session import LemmySession
session: LemmySession = LemmySession(website='https://lemmy.world/',
username='TestUlrikHD',
password='---',
end_script_signal=None)
posts: list[dict[[str, any]]] = []
cutoff_date: datetime.datetime = datetime.datetime.now(datetime.timezone.utc) - datetime.timedelta(days=365)
page_count: int = 1
loop_break: bool = False
while True:
post_response: dict[str, any] = session.get_posts(community=LemmyCommunity('football', 'lemmy.world'),
page=page_count)
page_count += 1
for post in post_response['posts']:
if datetime.datetime.fromisoformat(post['post']['published']) > cutoff_date:
posts.append(post)
else:
loop_break = True
break
if loop_break:
break
user_dict: dict[str, dict[str, any]] = {}
for post in posts:
user_dict[str(LemmyUser(post['creator']['actor_id']))] = {'post': True, 'post_id': post['post']['id']}
comments = session.get_post_comments(post_id=post['post']['id'])
for comment in comments['comments']:
user: str = str(LemmyUser(comment['creator']['actor_id']))
if user not in user_dict:
user_dict[user] = {'post': False, 'post_id': comment['post']['id'], 'parent_id': comment['comment']['id']}
del user_dict[str(LemmyUser('[email protected]'))]
del user_dict[str(LemmyUser('[email protected]'))]
with open('user_dict', 'w', encoding='utf-8') as file:
dump(user_dict, file, ensure_ascii=False, indent=4)
def log_reply(usr: str) -> None:
user_list: list[str] = []
if os.path.isfile('reply_list.json'):
with open('reply_list.json', 'r', encoding='utf-8') as file:
user_list = load(file)
user_list.append(str(usr))
with open('reply_list.json', 'w', encoding='utf-8') as file:
dump(user_list, file, ensure_ascii=False, indent=4)
for username, user in user_dict.items():
time.sleep(1)
try:
#if user['post']:
# session.reply(content='migration message', post_id=user['post_id'], parent_id=None)
#else:
# session.reply(content='migration message', post_id=user['post_id'], parent_id=user['parent_id'])
log_reply(usr=LemmyUser(username).str_link())
except requests.HTTPError as e:
print(f'Failed to send message to {username} - {e}')
and this part creates txt for easy copy pasting for tagging.
from json import load
with open('reply_list.json', 'r', encoding='utf-8') as file:
user_list: list[str] = load(file)
loop_count: int = len(', '.join(user_list)) // 9500 + 1
for i in range(loop_count):
with open(f'reply_list_{i}.txt', 'w', encoding='utf-8') as file:
print(len(' '.join(user_list[i * len(user_list) // loop_count:(i + 1) * len(user_list) // loop_count])))
file.write(', '.join(user_list[i * len(user_list) // loop_count:(i + 1) * len(user_list) // loop_count]))
Comment on
Which Fifa/PES did you grow up with?
It wasn't my first FIFA game, but FIFA World Cup 2010 was an absolute gem. Everything from the music selection, the atmosphere during the game, to the selection globe when picking a team. It certainly defined that summer for me.
Comment on
The Witcher 4 | Gameplay Tech Demo
Reply in thread
It's a mix, even if the names are more celtic, the culture is inspired by norse culture. CDPR initially considered having the people of Skellige speak Norwegian.
Comment on
[meta] Vote on the instance for the community (closed for voting)
Reply in thread
Comment on
Welcome to [email protected], Lemmy's new home to The Beautiful Game ⚽
Reply in thread
Sounds like a bug that should be raised to the voyager dev, community names should be case insensitive. You can make a report here, if you don't have a github account I can do it for you if you want?
Comment on
[Announcement] Community migration to [email protected]
Reply in thread
If you are referring FootballAutoMod it's a very basic bot I wrote for posting weekly discussion threads. The tagging of people were just a simple script I wrote to get a list of everyone who have interacted with the community in the last 365 days and then splitting the list up to get within the 10k character limit for comments.
Comment on
[Announcement] Community migration to [email protected]
Reply in thread
If you need any technical help, you can message me at @[email protected]
Comment on
[meta] Vote on the instance for the community (closed for voting)
Reply in thread
Comment on
Welcome to [email protected], Lemmy's new home to The Beautiful Game ⚽
Reply in thread
I feel pretty sympathetic with the admin team. They're in a spot where it's impossible to not make one group or another angry. They are probably doing their best to create a nice server. It's clear from their ad hoc rules that the team keep facing new problems they weren't expecting.
Comment on
LiveThreadBot
Reply in thread
-football Atalanta - Napoli
Comment on
[meta] Discussion on where to migrate the community.
Reply in thread
I never really wanted to be the main moderator in the first place, I'd be happy to let someone else take the responsibility.
I'll still put up a poll to see what the community at large wants though.
Comment on
[meta] Discussion on where to migrate the community.
Reply in thread
The bot isn't tied to the admin role, I started on it before I became a moderator for [email protected]
Comment on
Welcome to [email protected], Lemmy's new home to The Beautiful Game ⚽
@[email protected] -mod_action whitelist [email protected]
Comment on
Brentford 0 - [2] Liverpool - Darwin Núnez 90+3'
Reply in thread
He took those transfer rumours personally it seems
Comment on
What about club world cup prediction game?
I'm all for it, would be happy to help with it
Comment on
Jules Kounde joking about his shoes shape
Fair is fair, can't complain when we rely on tight margins with the high line ourselves.
Lewandowski's "clown shoe" model was more upsetting.