blob: 9aa24801e25e6b8e65b78c2a38bdddcda32be9ec (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
#!/usr/bin/env python3
import re
from bs4 import BeautifulSoup
import requests
import os
print("Access-Control-Allow-Origin: *") # CORS shit, needed for styling iframes apparently
profile_id = os.environ['QUERY_STRING'].strip()
if not profile_id.isdigit():
print("Status: 400 Bad Request")
print("Content-Type: text/plain")
print()
current_url = "https://" if os.environ.get("HTTPS") else "http://"
current_url += os.environ.get("HTTP_HOST") + os.environ.get("REQUEST_URI")
if current_url.endswith("?"+profile_id):
current_url = current_url[:-len(profile_id)-1]
print(f"you have to put your user id as a query, like {current_url}?6498")
quit()
headers = {
'User-Agent': f'agora status fetcher - contact forum user "garret 427738" or https://427738.xyz/hate-mail.html - requested by {os.environ.get("REMOTE_ADDR")}',
}
profile_html = requests.get("https://forum.agoraroad.com/index.php?members/" + profile_id, headers=headers).text
soup = BeautifulSoup(profile_html, 'lxml')
profile_post = soup.find("div", attrs={
"class": "lbContainer js-lbContainer",
"data-lb-id": re.compile(r"profile\-post\-\d+")
})
is_loginwall = soup.find("html", class_='has-no-js template-login') != None
if profile_post is None:
print("Content-Type: text/plain; charset=utf-8")
if is_loginwall:
print("Status: 403")
print()
print("🚨🚨🚨 schizo alert! 🚨🚨🚨")
print("it won't work if you don't expose your profile to the public, sorry")
else:
print("Status: 500")
print()
print("it didn't work for some reason, possibly you don't have any posts on your profile")
quit()
print("Content-Type: text/html; charset=utf-8")
print()
print(profile_post)
|