Skip to content

Instantly share code, notes, and snippets.

@der-Daniel der-Daniel/delete_ilch.py
Last active Sep 25, 2019

Embed
What would you like to do?
Überschreibt alle ilch-Foren Posts
import re
import time
from bs4 import BeautifulSoup as bs
import requests
SITES = 6 # hier anzahl seiten angeben, die die threads listen. siehe: https://www.ilch.de/forum-aeit.html
TEXT = """Dieses Skript ueberschreibt all deine Forum Posts!\n\n
Da ilch meiner DSGVO-Loeschanfrage nicht nachkommen wollte, habe ich dieses Skript geschrieben. Es ueberschreibt jegliche Forum Posts mit diesem Text.\n\n
Leider hat man als Privatperson keine Chance eine DSGVO Klage durchzubringen. ilch hat auf Zeit/Aufwand gespielt.\n\n
Wenn ihr eure Posts auch loeschen wollt, hier ist das Skript:\n
https://gist.github.com/der-Daniel/d359b0b4d6d639be67a7db7dfda6888b
"""
headers = {
"Host": "www.ilch.de",
"Referer": "https://www.ilch.de/usercp.html",
"Connection": "keep-alive",
"Cookie": "", # hier login cookie einsetzen
"Upgrade-Insecure-Requests": "1",
"Cache-Control": "max-age=0",
}
def get_thread_ids(soup):
ankers = soup.findAll("a", {"class": "openTopic"})
thread_ids = []
for anker in ankers:
try:
thread_ids.append(re.findall(r"showposts-(.*?)-p1", anker['href'])[0])
except IndexError:
pass
return thread_ids
def get_post_edit_links(thread_id):
thread_soup = bs(requests.get(f"https://www.ilch.de/forum-showposts-{thread_id}-p1.html").text)
post_ids = [li['id'][5:] for li in thread_soup.findAll('li') if 'Hulkster' in li.text]
return [
f"https://www.ilch.de/forum-editpost-{thread_id}-{post_id}.html"
for post_id in post_ids
]
for i in range(0, SITES + 1):
print(f"Crawling thread page {i + 1}/{SITES}")
if i == 0:
thread_ids = get_thread_ids(bs(requests.get("https://www.ilch.de/forum-aeit.html", headers=headers).text))
else:
thread_ids = get_thread_ids(bs(requests.get(f"https://www.ilch.de/forum-aeit-p{i}.html", headers=headers).text))
for thread_id in thread_ids:
post_edit_links = get_post_edit_links(thread_id)
for post_edit_link in post_edit_links:
print(post_edit_link)
requests.post(
url=post_edit_link,
data={
"txt": TEXT,
"bbcode": "1",
"sig": "0",
"alert": ""
},
headers=headers
)
time.sleep(0.2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.