ArneVogel / concat

Download your vods from twitch in the command line
https://www.arnevogel.com/standalone-concat-version/
GNU General Public License v3.0
205 stars 33 forks source link

Fix last VOD quality setting not being recognized #63

Closed FLWL closed 4 years ago

FLWL commented 4 years ago

There is an issue where the last VOD quality in the Usher API response is not detected and cannot be downloaded.

In func accessUsherAPI, the response from the Usher API respString contains a bunch of quality entries in the format of

...

EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="1080p60",NAME="1080p60",AUTOSELECT=YES,DEFAULT=YES

EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=5265424,CODECS="avc1.4D4028,mp4a.40.2",RESOLUTION=1920x1080,VIDEO="1080p60"

http://d2nvs31859zcd8.cloudfront.net/twitch/.../index-dvr.m3u8 ...

The regex currently used to match each entry is VIDEO="([^\"]+)"\n([^\n]+)\n. The problem is that the last quality entry will not get matched, because the response ends without a newline character. I therefore propose removing the last newline character requirement, that is, changing the regex to VIDEO="([^\"]+)"\n([^\n]+). This will ensure that the last quality entry will also be matched. Also it should not break other matches, since the last part of the regex ([^\n]+) will stop matching once it encounters a newline anyway.

This is likely the cause of issue #53 where VODs with only one quality setting cannot be downloaded at all.

Wiethoofd commented 4 years ago

A new release with this fixed would be highly appreciated to be able to download and archive vods again to cut up locally, instead of having to wait for Twitch's atrociously long download process for your own vods.