Skip to content

Instantly share code, notes, and snippets.

@TransparentLC
Created March 12, 2023 15:40
Show Gist options
  • Save TransparentLC/67e5268fdd95b4548e38f2d93200f773 to your computer and use it in GitHub Desktop.
Save TransparentLC/67e5268fdd95b4548e38f2d93200f773 to your computer and use it in GitHub Desktop.
import re
import requests
s = requests.Session()
r = s.get('https://moderatecontent.com/')
logid = re.search(r"var log_id = '([\da-f]+)';", r.text).group(1)
# r = s.post(
# 'https://moderatecontent.com/api/upload.php',
# files={
# 'file': open('1049-600x400.webp', 'rb'),
# },
# )
r = s.get(
'https://moderatecontent.com/api/web_api.php',
params={
'key': '25b34df5dfadfcf4e05fd617dee8da05',
'log_id': logid,
# 'url': r.text,
'url': 'https://moderatecontent.com/api/images/5dfa646d13e9d96d2193f0229a13b497.webp',
},
)
# {
# "url_classified": "https://moderatecontent.com/api/images/5dfa646d13e9d96d2193f0229a13b497.webp",
# "rating_index": 1,
# "rating_letter": "e",
# "predictions": {
# "teen": 0.06820349371992052,
# "everyone": 99.63322877883911,
# "adult": 0.29856429900974035
# },
# "rating_label": "everyone",
# "error_code": 0
# }
print(r.json())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment