sync simplification
- drop token compilation to html - drop artlebedev typograph - drop other small things
This commit is contained in:
1 parent
5f51a6e00d
commit
c1a3af3a3e
13 files changed
+73
-443
No files matched your search
@@ -11,22 +11,11 @@ class YoutubeToken(UrlToken):
|
||||
url = urlparse(data)
|
||||
return url.netloc in ['www.youtube.com', 'youtube.com']
|
||||
|
||||
async def compile(self):
|
||||
"""
|
||||
<div class="kazimir__video">
|
||||
<iframe src="http://www.youtube.com/embed/9otNWTHOJi8" frameborder="0" allowfullscreen></iframe>
|
||||
</div>
|
||||
"""
|
||||
def __init__(self, data: str) -> None:
|
||||
super().__init__(data=data)
|
||||
self.name = 'youtube'
|
||||
|
||||
url = urlparse(self.data)
|
||||
query = parse_qs(url.query)
|
||||
|
||||
if 'v' not in query:
|
||||
return ''
|
||||
|
||||
video_id = query['v'][0]
|
||||
|
||||
url = f'//www.youtube.com/embed/{video_id}'
|
||||
return f'''
|
||||
<div class="kazimir__video"><iframe src="{url}" frameborder="0" allowfullscreen></iframe></div>
|
||||
'''.strip()
|
||||
async def get_data(self):
|
||||
return {
|
||||
'url': self.data
|
||||
}
|
||||
Reference in new issue
Block a user