always store orgy urls for consistency and working links
parent
c10724200f
commit
d9c665a872
|
@ -213,7 +213,9 @@ def schedule_orgy(v, chat_id):
|
|||
if bare_youtube_regex.match(normalized_link):
|
||||
orgy_type = 'youtube'
|
||||
data, _ = get_youtube_id_and_t(normalized_link)
|
||||
if YOUTUBE_KEY != DEFAULT_CONFIG_VALUE:
|
||||
if YOUTUBE_KEY == DEFAULT_CONFIG_VALUE:
|
||||
data = f'https://cdpn.io/pen/debug/NWeVNRj?v={data}&autoplay=1'
|
||||
else:
|
||||
req = requests.get(f"https://www.googleapis.com/youtube/v3/videos?id={data}&key={YOUTUBE_KEY}&part=contentDetails", headers=HEADERS, timeout=5).json()
|
||||
duration = req['items'][0]['contentDetails']['duration']
|
||||
if duration != 'P0D':
|
||||
|
@ -238,6 +240,7 @@ def schedule_orgy(v, chat_id):
|
|||
elif twitch_regex.match(normalized_link):
|
||||
orgy_type = 'twitch'
|
||||
data = twitch_regex.search(normalized_link).group(3)
|
||||
data = f'https://player.twitch.tv/?channel={data}&parent={SITE}'
|
||||
elif any((normalized_link.lower().endswith(f'.{x}') for x in VIDEO_FORMATS)):
|
||||
domain = tldextract.extract(normalized_link).registered_domain
|
||||
if domain != 'archive.org' and not is_safe_url(normalized_link):
|
||||
|
@ -269,12 +272,12 @@ def schedule_orgy(v, chat_id):
|
|||
ma = ModAction(
|
||||
kind="schedule_orgy",
|
||||
user_id=v.id,
|
||||
_note=f'<a href="{normalized_link}" rel="nofollow noopener">{title}</a>',
|
||||
_note=f'<a href="{orgy.data}" rel="nofollow noopener">{title}</a>',
|
||||
)
|
||||
g.db.add(ma)
|
||||
|
||||
if AEVANN_ID and v.id != AEVANN_ID:
|
||||
text = f"@{v.username} has started [{title}]({normalized_link}) in [{chat.name}](/chat/{chat.id})"
|
||||
text = f"@{v.username} has started [{title}]({orgy.data}) in [{chat.name}](/chat/{chat.id})"
|
||||
send_repeatable_notification(AEVANN_ID, text)
|
||||
|
||||
return redirect(f"/chat/{chat_id}/orgies")
|
||||
|
|
|
@ -23,15 +23,13 @@
|
|||
<div>
|
||||
<p id="orgy-file-container" class="resizable">
|
||||
{% if orgy.type == 'youtube' %}
|
||||
<iframe style="border: none" sandbox="allow-scripts allow-same-origin allow-popups allow-presentation allow-popups-to-escape-sandbox" title="Play" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen src="https://cdpn.io/pen/debug/NWeVNRj?v={{orgy.data}}&autoplay=1{% if orgy.end_utc %}&start={{orgy.seconds_since_starts}}{% endif %}"></iframe>
|
||||
{% elif orgy.type == 'rumble' %}
|
||||
<iframe src="{{orgy.data}}" frameborder="0" allowfullscreen></iframe>
|
||||
{% elif orgy.type == 'twitch' %}
|
||||
<iframe src="https://player.twitch.tv/?channel={{orgy.data}}&parent={{SITE}}" frameborder="0" allowfullscreen></iframe>
|
||||
<iframe style="border: none" sandbox="allow-scripts allow-same-origin allow-popups allow-presentation allow-popups-to-escape-sandbox" title="Play" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen src="{{orgy.data}}{% if orgy.end_utc %}&start={{orgy.seconds_since_starts}}{% endif %}"></iframe>
|
||||
{% elif orgy.type == 'file' %}
|
||||
<video id="orgy-file" data-created_utc="{{orgy.real_start_utc}}" controls preload="none" src="{{orgy.data}}"></video>
|
||||
<video id="break-file" class="d-none" controls preload="none" src="/assets/break.mp4" data-run="{{orgy.start_utc != orgy.real_start_utc}}"></video>
|
||||
<script defer src="{{'js/orgy_file.js' | asset}}"></script>
|
||||
{% else %}
|
||||
<iframe src="{{orgy.data}}" frameborder="0" allowfullscreen></iframe>
|
||||
{% endif %}
|
||||
</p>
|
||||
{% if (orgies)|length > 1 %}
|
||||
|
|
Loading…
Reference in New Issue