Skip to content

Commit 661c90c

Browse files
committed
add resolution to parser
1 parent dac1990 commit 661c90c

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

resources/lib/twitch/parser.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
r'NAME="(?P<group_name>[^"]*)"[,=\w]*\n'
2222
r'#EXT-X-STREAM-INF:.*'
2323
r'BANDWIDTH=(?P<bandwidth>[0-9]+),'
24+
r'(?:.*RESOLUTION="*(?P<resolution>[0-9xX]+)"*,)?'
2425
r'(?:.*FRAME-RATE=(?P<fps>[0-9.]+))?.*\n'
2526
r'(?P<url>http.*)')
2627

@@ -89,7 +90,8 @@ def m3u8_to_dict(string):
8990
'name': name,
9091
'url': m.group('url'),
9192
'bandwidth': int(m.group('bandwidth')),
92-
'fps': fps
93+
'fps': fps,
94+
'resolution': m.group('resolution')
9395
}
9496
log.debug('m3u8_to_dict result:\n{0}'.format(d))
9597
return d
@@ -117,7 +119,8 @@ def m3u8_to_list(string):
117119
'name': name,
118120
'url': m.group('url'),
119121
'bandwidth': int(m.group('bandwidth')),
120-
'fps': fps
122+
'fps': fps,
123+
'resolution': m.group('resolution')
121124
})
122125

123126
log.debug('m3u8_to_list result:\n{0}'.format(l))

0 commit comments

Comments
 (0)