Ver código fonte

Pass <meta> tags along in the age gate

master
Fen Dweller 5 anos atrás
pai
commit
262a957885
3 arquivos alterados com 39 adições e 3 exclusões
  1. +27
    -3
      app.py
  2. +11
    -0
      requirements.txt
  3. +1
    -0
      templates/age-gate.html

+ 27
- 3
app.py Ver arquivo

@@ -2,8 +2,9 @@ from flask import Flask, render_template, redirect, request
from time import time from time import time
from urllib.parse import urlparse, unquote from urllib.parse import urlparse, unquote
from markdown2 import markdown from markdown2 import markdown
import requests
import json import json
import os.path
from bs4 import BeautifulSoup


app = Flask( app = Flask(
__name__, __name__,
@@ -22,8 +23,31 @@ def nightly():


@app.route('/agegate') @app.route('/agegate')
def agegate(): def agegate():
url = unquote(request.url.split("?to=")[1])
return render_template("age-gate.html", url=url)
url = request.args.get("url", default=None)

try:
if urlparse(url).netloc and urlparse(url).netloc[-9:] != "crux.sexy":
print("URL is not pointing at crux.sexy")
url = "https://crux.sexy/"
except:
url = "https://crux.sexy"

try:
r = requests.get(url, cookies={"agegate": "true"})
soup = BeautifulSoup(r.text, "html5lib")

headers = []

for item in soup.head.findAll("meta"):
if item.has_attr("name") and item["name"] == "viewport":
continue
if item.has_attr("content"):
headers.append(str(item))
except:
headers = []

return render_template("age-gate.html", url=url, headers="\n".join(headers))


@app.route('/accept') @app.route('/accept')
def accept(): def accept():


+ 11
- 0
requirements.txt Ver arquivo

@@ -1,6 +1,17 @@
beautifulsoup4==4.9.3
certifi==2020.12.5
chardet==4.0.0
Click==7.0 Click==7.0
Flask==1.1.1 Flask==1.1.1
html5lib==1.1
idna==2.10
itsdangerous==1.1.0 itsdangerous==1.1.0
Jinja2==2.10.3 Jinja2==2.10.3
markdown2==2.4.0
MarkupSafe==1.1.1 MarkupSafe==1.1.1
requests==2.25.1
six==1.16.0
soupsieve==2.2.1
urllib3==1.26.5
webencodings==0.5.1
Werkzeug==0.16.0 Werkzeug==0.16.0

+ 1
- 0
templates/age-gate.html Ver arquivo

@@ -3,6 +3,7 @@
<head> <head>
<title>Age Gate</title> <title>Age Gate</title>
<link rel="stylesheet" type="text/css" href="sexy.css"> <link rel="stylesheet" type="text/css" href="sexy.css">
{{headers|safe}}
</head> </head>
<body> <body>
<div class="box"> <div class="box">


Carregando…
Cancelar
Salvar