jenslys / autovod

Automatically upload Twitch.tv / Kick.com streams in realtime to Youtube or a Rclone supported provider
MIT License
94 stars 10 forks source link

[Fix] - Headers/options not being added properly #71

Closed jenslys closed 1 year ago

jenslys commented 1 year ago

Description

This changes STREAMLINK_FLAGS from a variable to an array and passe the values properly too Streamlink with support for spaces in the flag. Also fixed some typos in the script and readme file

Warning You will need to update your existing config with the new changes (array instead of just a string variable)

Before:

STREAMLINK_FLAGS="--twitch-disable-hosting --twitch-disable-reruns"

After:

STREAMLINK_FLAGS=("--twitch-disable-hosting" "--twitch-disable-reruns")

TOOD:

Related Issues

Checklist

Docker logs

2023-08-06 02:13:34 00:13:34| Docker detected
2023-08-06 02:13:34 00:13:34| Selected streamer: ropz
2023-08-06 02:13:34 00:13:34| Found config file
2023-08-06 02:13:34 00:13:34| Starting AutoVOD
2023-08-06 02:13:34 00:13:34| Loading ropz.config
2023-08-06 02:13:34 
2023-08-06 02:13:34 00:13:34| Checking twitch.tv/ropz for a stream
2023-08-06 02:13:35 [cli][info] streamlink is running as root! Be careful!
2023-08-06 02:13:35 [cli][debug] OS:         Linux-5.15.49-linuxkit-aarch64-with
2023-08-06 02:13:35 [cli][debug] Python:     3.10.12
2023-08-06 02:13:35 [cli][debug] Streamlink: 6.0.1
2023-08-06 02:13:35 [cli][debug] Dependencies:
2023-08-06 02:13:35 [cli][debug]  certifi: 2023.7.22
2023-08-06 02:13:35 [cli][debug]  isodate: 0.6.1
2023-08-06 02:13:35 [cli][debug]  lxml: 4.9.3
2023-08-06 02:13:35 [cli][debug]  pycountry: 22.3.5
2023-08-06 02:13:35 [cli][debug]  pycryptodome: 3.18.0
2023-08-06 02:13:35 [cli][debug]  PySocks: 1.7.1
2023-08-06 02:13:35 [cli][debug]  requests: 2.31.0
2023-08-06 02:13:35 [cli][debug]  trio: 0.22.2
2023-08-06 02:13:35 [cli][debug]  trio-websocket: 0.10.3
2023-08-06 02:13:35 [cli][debug]  typing-extensions: 4.7.1
2023-08-06 02:13:35 [cli][debug]  urllib3: 2.0.4
2023-08-06 02:13:35 [cli][debug]  websocket-client: 1.6.1
2023-08-06 02:13:35 [cli][debug] Arguments:
2023-08-06 02:13:35 [cli][debug]  url=twitch.tv/ropz
2023-08-06 02:13:35 [cli][debug]  stream=['480p']
2023-08-06 02:13:35 [cli][debug]  --loglevel=debug
2023-08-06 02:13:35 [cli][debug]  --output=-
2023-08-06 02:13:35 [cli][debug]  --stdout=True
2023-08-06 02:13:35 [cli][debug]  --hls-duration=300
2023-08-06 02:13:35 [cli][debug]  --twitch-disable-reruns=True
2023-08-06 02:13:35 [cli][debug]  --twitch-api-header=[('Authorization', 'OAuth abc123123')]
2023-08-06 02:13:35 [cli][info] Found matching plugin twitch for URL twitch.tv/ropz
2023-08-06 02:13:35 [plugins.twitch][debug] Getting live HLS streams for ropz
2023-08-06 02:13:35 [plugins.twitch][debug] {'adblock': False, 'geoblock_reason': '', 'hide_ads': False, 'server_ads': True, 'show_ads': True}
2023-08-06 02:13:35 [utils.l10n][debug] Language code: en_US
2023-08-06 02:13:35 [cli][info] Available streams: audio_only, 160p (worst), 360p, 480p, 720p, 720p60, 1080p60 (best)
2023-08-06 02:13:35 [cli][info] Opening stream: 480p (hls)
2023-08-06 02:13:35 [stream.hls][debug] Reloading playlist
2023-08-06 02:13:35 [cli][debug] Pre-buffering 8192 bytes
2023-08-06 02:13:36 [stream.hls][debug] First Sequence: 2204; Last Sequence: 2217
2023-08-06 02:13:36 [stream.hls][debug] Start offset: 0; Duration: 300; Start Sequence: 2215; End Sequence: None
2023-08-06 02:13:36 [stream.hls][debug] Adding segment 2215 to queue
2023-08-06 02:13:36 [stream.hls][debug] Adding segment 2216 to queue
2023-08-06 02:13:36 [stream.hls][debug] Adding segment 2217 to queue
2023-08-06 02:13:36 [stream.hls][debug] Writing segment 2215 to output
Zfalcor commented 1 year ago

The OAuth code is passed successfully and I receive 'show_ads':False instead of show_ads':True so it seems to be working with an account with a sub or Twitch Turbo. Thank you for the update.

[14:34:09.452327][plugins.twitch][debug] {'adblock': False, 'geoblock_reason': '', 'hide_ads': True, 'server_ads': True, 'show_ads': False}

With 00:05:00 duration I successfully uploaded a test video, no ads/purple screens were displayed or discarded fragments. The video was uploaded with the correct title/description from meta info and the correct playlist from STREAMLINK_FLAGS array. This should mean testing is complete for update https://github.com/jenslys/autovod/pull/71.

The end duration was 00:05:01 before youtube processing was completed which explains why a limit of 12:00:00 or 11:59:59 fails to upload. The cut-off is slightly longer due to hls segment length/calculations.

Ubuntu WSL(Windows Subsystem for Linux) Logs

If any further logs are needed feel free to ask.

lunarpetunia-out.log

17:06:49| Docker not detected
17:06:49| Selected streamer: lunarpetunia
17:06:49| Found config file
17:06:49| Starting AutoVOD
17:06:49| Loading lunarpetunia.config

17:06:49| Trying to fetch stream metadata
17:06:50| Stream is online!
17:06:50| Current Title: WildRP | Danya Fetherly | Reconciling  Danya diaries #5
17:06:50| Current Game: Red Dead Redemption 2

17:06:50| Checking twitch.tv/lunarpetunia for a stream
17:06:50| All required files found
17:12:26| Stream uploaded to youtube

lunarpetunia-error.log

[17:06:50.341928][cli][debug] OS:         Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.35
[17:06:50.342090][cli][debug] Python:     3.10.12
[17:06:50.342144][cli][debug] Streamlink: 6.0.1
[17:06:50.342884][cli][debug] Dependencies:
[17:06:50.344377][cli][debug]  certifi: 2023.5.7
[17:06:50.344841][cli][debug]  isodate: 0.6.1
[17:06:50.345153][cli][debug]  lxml: 4.9.3
[17:06:50.345850][cli][debug]  pycountry: 22.3.5
[17:06:50.346174][cli][debug]  pycryptodome: 3.18.0
[17:06:50.347018][cli][debug]  PySocks: 1.7.1
[17:06:50.347781][cli][debug]  requests: 2.31.0
[17:06:50.348272][cli][debug]  trio: 0.22.2
[17:06:50.348747][cli][debug]  trio-websocket: 0.10.3
[17:06:50.349207][cli][debug]  typing-extensions: 4.7.1
[17:06:50.349783][cli][debug]  urllib3: 2.0.3
[17:06:50.350316][cli][debug]  websocket-client: 1.6.1
[17:06:50.350601][cli][debug] Arguments:
[17:06:50.350717][cli][debug]  url=twitch.tv/lunarpetunia
[17:06:50.350777][cli][debug]  stream=['best']
[17:06:50.350827][cli][debug]  --loglevel=all
[17:06:50.350877][cli][debug]  --stdout=True
[17:06:50.350925][cli][debug]  --hls-duration=300
[17:06:50.350988][cli][debug]  --twitch-disable-hosting=True
[17:06:50.351025][cli][debug]  --twitch-disable-reruns=True
[17:06:50.351064][cli][debug]  --twitch-api-header=[('Authorization', 'OAuth abc123123')]
[17:06:50.351329][cli][info] Found matching plugin twitch for URL twitch.tv/lunarpetunia
[17:06:50.685867][plugins.twitch][debug] Getting live HLS streams for lunarpetunia
[17:06:50.881682][plugins.twitch][debug] {'adblock': False, 'geoblock_reason': '', 'hide_ads': True, 'server_ads': True, 'show_ads': False}
[17:06:50.930585][utils.l10n][debug] Language code: en_US

...

[17:06:51.377258][cli][info] Available streams: audio_only, 160p (worst), 360p, 480p, 720p, 1080p (best)
[17:06:51.377383][cli][info] Opening stream: 1080p (hls)
[17:06:51.378220][stream.hls][debug] Reloading playlist
[17:06:51.378335][cli][debug] Pre-buffering 8192 bytes
[17:06:52.114040][stream.hls_playlist][all] #EXT-X-VERSION:3
[17:06:52.114274][stream.hls_playlist][all] #EXT-X-TARGETDURATION:6
[17:06:52.114333][stream.hls_playlist][all] #EXT-X-MEDIA-SEQUENCE:2782
[17:06:52.114374][stream.hls_playlist][all] #EXT-X-TWITCH-LIVE-SEQUENCE:2782
[17:06:52.114409][stream.hls_playlist][all] #EXT-X-TWITCH-ELAPSED-SECS:5564.000
[17:06:52.114485][stream.hls_playlist][all] #EXT-X-TWITCH-TOTAL-SECS:5596.000

...

[17:06:52.120298][stream.hls][debug] First Sequence: 2782; Last Sequence: 2795
[17:06:52.120342][stream.hls][debug] Start offset: 0; Duration: 300; Start Sequence: 2793; End Sequence: None
[17:06:52.120380][stream.hls][debug] Adding segment 2793 to queue
[17:06:52.122693][stream.hls][debug] Adding segment 2794 to queue
[17:06:52.123610][stream.hls][debug] Adding segment 2795 to queue
[17:06:53.028153][stream.hls][debug] Writing segment 2793 to output
[17:06:53.030127][stream.hls][debug] Segment 2793 complete
[17:06:53.030463][cli][debug] Writing stream to output
[17:06:53.355472][stream.hls][debug] Writing segment 2794 to output
[17:06:53.356545][stream.hls][debug] Segment 2794 complete
[17:06:53.561511][stream.hls][debug] Writing segment 2795 to output
[17:06:53.563125][stream.hls][debug] Segment 2795 complete
[17:06:57.378495][stream.hls][debug] Reloading playlist
[17:06:57.895813][stream.hls_playlist][all] #EXT-X-VERSION:3
[17:06:57.896017][stream.hls_playlist][all] #EXT-X-TARGETDURATION:6
[17:06:57.896078][stream.hls_playlist][all] #EXT-X-MEDIA-SEQUENCE:2785
[17:06:57.896120][stream.hls_playlist][all] #EXT-X-TWITCH-LIVE-SEQUENCE:2785
[17:06:57.896155][stream.hls_playlist][all] #EXT-X-TWITCH-ELAPSED-SECS:5570.000
[17:06:57.896190][stream.hls_playlist][all] #EXT-X-TWITCH-TOTAL-SECS:5602.000

...

[17:06:57.901260][stream.hls][debug] Adding segment 2796 to queue
[17:06:57.901494][stream.hls][debug] Adding segment 2797 to queue
[17:06:57.901626][stream.hls][debug] Adding segment 2798 to queue
[17:06:58.380770][stream.hls][debug] Writing segment 2796 to output
[17:06:58.383229][stream.hls][debug] Segment 2796 complete
[17:06:58.684242][stream.hls][debug] Writing segment 2797 to output
[17:06:58.686235][stream.hls][debug] Segment 2797 complete
[17:06:58.907847][stream.hls][debug] Writing segment 2798 to output
[17:06:58.909184][stream.hls][debug] Segment 2798 complete
[17:07:03.378474][stream.hls][debug] Reloading playlist
[17:07:03.825155][stream.hls_playlist][all] #EXT-X-VERSION:3
[17:07:03.825361][stream.hls_playlist][all] #EXT-X-TARGETDURATION:6
[17:07:03.825422][stream.hls_playlist][all] #EXT-X-MEDIA-SEQUENCE:2788
[17:07:03.825464][stream.hls_playlist][all] #EXT-X-TWITCH-LIVE-SEQUENCE:2788
[17:07:03.825500][stream.hls_playlist][all] #EXT-X-TWITCH-ELAPSED-SECS:5576.000
[17:07:03.825533][stream.hls_playlist][all] #EXT-X-TWITCH-TOTAL-SECS:5608.000

...

[17:11:50.252152][stream.hls][debug] Adding segment 2942 to queue
[17:11:50.252367][stream.hls][info] Stopping stream early after 300
[17:11:50.252476][stream.segmented][debug] Closing worker thread
[17:11:50.632082][stream.hls][debug] Writing segment 2942 to output
[17:11:50.633190][stream.hls][debug] Segment 2942 complete
[17:11:50.633303][stream.segmented][debug] Closing writer thread
[17:12:11.449072][cli][info] Stream ended
[17:12:11.449297][cli][info] Closing currently open stream...
jenslys commented 1 year ago

@Zfalcor yeah i am aware of the youtube issue, i can add som sort of doc regarding this.

Thanks for testing!