mirror of
https://github.com/asciinema/asciinema.git
synced 2025-12-15 19:28:00 +01:00
@@ -206,7 +206,7 @@ Playing from HTTP(S) URL:
|
||||
asciinema play http://example.com/demo.cast
|
||||
|
||||
Playing from asciicast page URL (requires `<link rel="alternate"
|
||||
type="application/asciicast+json" href="....json">` in page's HTML):
|
||||
type="application/x-asciicast" href="/my/ascii.cast">` in page's HTML):
|
||||
|
||||
asciinema play https://asciinema.org/a/22124
|
||||
asciinema play http://example.com/blog/post.html
|
||||
|
||||
@@ -19,14 +19,16 @@ class Parser(html.parser.HTMLParser):
|
||||
self.url = None
|
||||
|
||||
def handle_starttag(self, tag, attrs_list):
|
||||
# look for <link rel="alternate" type="application/asciicast+json" href="https://...json">
|
||||
# look for <link rel="alternate" type="application/x-asciicast" href="https://...cast">
|
||||
if tag == 'link':
|
||||
attrs = {}
|
||||
for k, v in attrs_list:
|
||||
attrs[k] = v
|
||||
|
||||
if attrs.get('rel') == 'alternate' and attrs.get('type') == 'application/asciicast+json':
|
||||
self.url = attrs.get('href')
|
||||
if attrs.get('rel') == 'alternate':
|
||||
type = attrs.get('type')
|
||||
if type == 'application/asciicast+json' or type == 'application/x-asciicast':
|
||||
self.url = attrs.get('href')
|
||||
|
||||
|
||||
def open_url(url):
|
||||
@@ -57,7 +59,7 @@ def open_url(url):
|
||||
url = parser.url
|
||||
|
||||
if not url:
|
||||
raise LoadError("""<link rel="alternate" type="application/asciicast+json" href="..."> not found in fetched HTML document""")
|
||||
raise LoadError("""<link rel="alternate" type="application/x-asciicast" href="..."> not found in fetched HTML document""")
|
||||
|
||||
return open_url(url)
|
||||
|
||||
|
||||
@@ -17,6 +17,9 @@ Example file:
|
||||
[6.541828, "o", "Bye!"]
|
||||
```
|
||||
|
||||
Suggested file extension is `.cast`, suggested media type is
|
||||
`application/x-asciicast`.
|
||||
|
||||
## Header
|
||||
|
||||
asciicast header is JSON-encoded object containing recording meta-data.
|
||||
|
||||
Reference in New Issue
Block a user