Add segment titles to description text

This commit is contained in:
Kumi 2023-06-01 21:10:13 +00:00
parent 1d28a5a445
commit 8cca298ba1
Signed by: kumi
GPG key ID: ECBCC9082395383F

View file

@ -94,6 +94,15 @@ with YoutubeDL(PARAMS) as ydl:
date = soup.find("span", {"class": "date"}).text
title = soup.find("span", {"class": "js-profile"}).text
video_id = url.split("/")[-1]
segments = soup.find_all("h4", {"class": "segment-title"})
segment_texts = []
for segment in segments:
segment_text = segment.text
segment_texts.append(segment_text)
description = "\n".join(segment_texts)
if not video_id:
video_id = url.split("/")[-2]
@ -128,6 +137,7 @@ with YoutubeDL(PARAMS) as ydl:
"filename": f"{timestamp}-{video_id}.mp4",
"name": f"{title} ({date})",
"privacy": "3",
"description": description,
}
upload_request = Request(
upload_url,