Skip to content
This repository has been archived by the owner on Aug 30, 2023. It is now read-only.

Commit

Permalink
Merge pull request #1 from CalciumSigma/main
Browse files Browse the repository at this point in the history
Add thumbnail support for URLS with timestamps
  • Loading branch information
ggogel authored Sep 24, 2022
2 parents c28d389 + fc51a7d commit 30c3f5c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion maubot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ maubot: 0.1.0
id: me.gogel.maubot.youtubepreview

# A PEP 440 compliant version string.
version: 0.0.1
version: 0.0.2

# The SPDX license identifier for the plugin. https://spdx.org/licenses/
# Optional, assumes all rights reserved if omitted.
Expand Down
3 changes: 2 additions & 1 deletion youtubepreview.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ async def on_message(self, evt: MessageEvent) -> None:
video_id = url.split("youtu.be/")[1]
else:
video_id = urllib.parse.parse_qs(urllib.parse.urlparse(url).query)['v'][0]

video_id = video_id.split("?", 1)[0]

params = {"format": "json", "url": url}
query_url = "https://www.youtube.com/oembed"
query_string = urllib.parse.urlencode(params)
Expand Down

0 comments on commit 30c3f5c

Please sign in to comment.