forked from MarseyWorld/MarseyWorld
sfdsfd
parent
8b398277d1
commit
44e90d9b7b
|
@ -212,7 +212,6 @@ def sanitize(sanitized, noimages=False):
|
|||
|
||||
sanitized = sanitized.replace("https://www.", "https://").replace("https://youtu.be/", "https://youtube.com/watch?v=").replace("https://music.youtube.com/watch?v=", "https://youtube.com/watch?v=").replace("https://open.spotify.com/", "https://open.spotify.com/embed/").replace("https://streamable.com/", "https://streamable.com/e/").replace("https://youtube.com/shorts/", "https://youtube.com/watch?v=").replace("https://mobile.twitter", "https://twitter").replace("https://m.facebook", "https://facebook").replace("https://m.wikipedia", "https://wikipedia").replace("https://m.youtube", "https://youtube")
|
||||
|
||||
|
||||
if "https://youtube.com/watch?v=" in sanitized: sanitized = sanitized.replace("?t=", "&t=")
|
||||
|
||||
for i in re.finditer('" target="_blank">(https://youtube\.com/watch\?v\=(.*?))</a>', sanitized):
|
||||
|
@ -220,6 +219,7 @@ def sanitize(sanitized, noimages=False):
|
|||
yt_id = i.group(2).split('&')[0].split('%')[0]
|
||||
replacing = f'<a href="{url}" rel="nofollow noopener noreferrer" target="_blank">{url}</a>'
|
||||
|
||||
print(url)
|
||||
params = parse_qs(urlparse(url).query)
|
||||
t = params.get('t', params.get('start', [0]))[0]
|
||||
if isinstance(t, str): t = t.replace('s','')
|
||||
|
|
|
@ -699,7 +699,7 @@ def submit_post(v):
|
|||
for rd in ["https://reddit.com/", "https://new.reddit.com/", "https://www.reddit.com/", "https://redd.it/"]:
|
||||
url = url.replace(rd, "https://old.reddit.com/")
|
||||
|
||||
url = url.replace("old.reddit.com/gallery", "new.reddit.com/gallery").replace("https://youtu.be/", "https://youtube.com/watch?v=").replace("https://music.youtube.com/watch?v=", "https://youtube.com/watch?v=").replace("https://open.spotify.com/", "https://open.spotify.com/embed/").replace("https://streamable.com/", "https://streamable.com/e/").replace("https://youtube.com/shorts/", "https://youtube.com/watch?v=").replace("https://mobile.twitter", "https://twitter").replace("https://m.facebook", "https://facebook").replace("https://m.wikipedia", "https://wikipedia").replace("https://m.youtube", "https://youtube")
|
||||
url = url.replace("old.reddit.com/gallery", "new.reddit.com/gallery").replace("https://youtu.be/", "https://youtube.com/watch?v=").replace("https://music.youtube.com/watch?v=", "https://youtube.com/watch?v=").replace("https://open.spotify.com/", "https://open.spotify.com/embed/").replace("https://streamable.com/", "https://streamable.com/e/").replace("https://youtube.com/shorts/", "https://youtube.com/watch?v=").replace("https://mobile.twitter", "https://twitter").replace("https://m.facebook", "https://facebook").replace("https://m.wikipedia", "https://wikipedia").replace("https://m.youtube", "https://youtube").replace("https://www.youtube", "https://youtube")
|
||||
|
||||
if url.startswith("https://streamable.com/") and not url.startswith("https://streamable.com/e/"): url = url.replace("https://streamable.com/", "https://streamable.com/e/")
|
||||
|
||||
|
|
|
@ -424,6 +424,23 @@
|
|||
</a>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% if p.embed_url %}
|
||||
{% if p.domain == "twitter.com" %}
|
||||
{{p.embed_url | safe}}
|
||||
{% if v and v.theme.split("_")[0] in ["light", "coffee", "4chan"] %}
|
||||
<script src="/assets/js/twitterlight.js?v=1"></script>
|
||||
{% else %}
|
||||
<script src="/assets/js/twitter.js?v=1"></script>
|
||||
{% endif %}
|
||||
<script>document.getElementById('twitter-widget-0').setAttribute('sandbox','')</script>
|
||||
{% elif p.domain in ['youtu.be','youtube.com'] and p.embed_url and p.embed_url.startswith('<lite-youtube') %}
|
||||
{{p.embed_url | safe}}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
|
||||
<div id="post-text">
|
||||
{% if p.is_image %}
|
||||
<div class="row no-gutters">
|
||||
|
@ -462,20 +479,6 @@
|
|||
|
||||
</div>
|
||||
|
||||
{% if p.embed_url %}
|
||||
{% if p.domain == "twitter.com" %}
|
||||
{{p.embed_url | safe}}
|
||||
{% if v and v.theme.split("_")[0] in ["light", "coffee", "4chan"] %}
|
||||
<script src="/assets/js/twitterlight.js?v=1"></script>
|
||||
{% else %}
|
||||
<script src="/assets/js/twitter.js?v=1"></script>
|
||||
{% endif %}
|
||||
<script>document.getElementById('twitter-widget-0').setAttribute('sandbox','')</script>
|
||||
{% elif p.domain in ['youtu.be','youtube.com'] and p.embed_url and p.embed_url.startswith('<lite-youtube') %}
|
||||
{{p.embed_url | safe}}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% if p.author.sig_html and (p.author_id == 1904 or not (v and v.sigs_disabled)) %}
|
||||
<hr>
|
||||
|
|
Loading…
Reference in New Issue