feat: Fetch livestreams and shorts
This commit is contained in:
parent
ddb309d21a
commit
24e9e9b427
1 changed files with 34 additions and 27 deletions
|
@ -56,7 +56,9 @@ url="https://www.youtube.com/@${channel}"
|
|||
if [[ "${channel}" = "subscriptions" ]]; then
|
||||
url="https://www.youtube.com/feed/subscriptions"
|
||||
fi
|
||||
if [[ -f "${cookies}" && "${channel}" = "subscriptions" ]]; then
|
||||
for full_url in "${url}/videos" "${url}/shorts" "${url}/streams"; do
|
||||
echo "${full_url}"
|
||||
if [[ -f "${cookies}" && "${channel}" = "subscriptions" ]]; then
|
||||
#If available, you can use the cookies from your browser directly. Substitute
|
||||
# --cookies "${cookies}"
|
||||
#for the below, substituting for your browser of choice:
|
||||
|
@ -68,21 +70,22 @@ if [[ -f "${cookies}" && "${channel}" = "subscriptions" ]]; then
|
|||
#then substitute the "--extractor-args" line below with
|
||||
# --extractor-args "youtubetab:approximate_date,youtube:player-client=default,mweb;po_token=mweb.gvs+${potoken}" \
|
||||
#including the backslash so the multiline command keeps working.
|
||||
"${python}" "${ytdl}" "${url}" \
|
||||
"${python}" "${ytdl}" "${full_url}" \
|
||||
--cookies "${cookies}" \
|
||||
--extractor-args "youtubetab:approximate_date" \
|
||||
--skip-download --download-archive "${archive}" \
|
||||
--dateafter "${breaktime}" \
|
||||
--break-on-reject --lazy-playlist --write-info-json \
|
||||
--sleep-requests "${sleeptime}"
|
||||
else
|
||||
"${python}" "${ytdl}" "${url}" \
|
||||
else
|
||||
"${python}" "${ytdl}" "${full_url}" \
|
||||
--extractor-args "youtubetab:approximate_date" \
|
||||
--skip-download --download-archive "${archive}" \
|
||||
--dateafter "${breaktime}" \
|
||||
--break-on-reject --lazy-playlist --write-info-json \
|
||||
--sleep-requests "${sleeptime}"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
if [[ ${enablecsv} = 1 ]]; then
|
||||
if [[ -f "${csv}" ]]; then
|
||||
rm -rf "${csv}"
|
||||
|
@ -162,9 +165,13 @@ if [[ ${enablecsv} = "1" ]]; then
|
|||
fi
|
||||
cd "${temporary}" || exit
|
||||
tar -cvp -I "zstd -T0" -f "${subfolder}/${channel}.tar.zst" -- *.info.json
|
||||
count=0
|
||||
total=$(find "${temporary}" -type f -iname "*.info.json" | wc -l)
|
||||
find "${temporary}" -type f -iname "*.info.json" | while read -r x; do
|
||||
count=$((count + 1))
|
||||
if [[ -f "${x}" ]]; then
|
||||
echo "youtube $(jq -cr '.id' "${x}")" >>"${archive}"
|
||||
echo "${count}/${total} ${x}"
|
||||
fi
|
||||
done
|
||||
sort "${archive}" | uniq >"/tmp/${channel}.txt" && mv "/tmp/${channel}.txt" "${archive}"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue