Browse Source

Add youtube-filter-autogen-channels

master
JustAnotherArchivist 4 years ago
parent
commit
4925a912c0
1 changed files with 17 additions and 0 deletions
  1. +17
    -0
      youtube-filter-autogen-channels

+ 17
- 0
youtube-filter-autogen-channels View File

@@ -0,0 +1,17 @@
#!/bin/bash
# Takes a list of YouTube URLs on stdin. URLs for autogenerated channels are written to FD 3, all other URLs go to stdout.
while read -r url
do
if [[ "${url}" == */channel/* ]]
then
header="$(curl -4sL -A 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36' -H 'Accept-Language: en-US,en;q=0.5' "${url}?disable_polymer=1" | \
tr -d '\n' | \
grep -Po '<div\s([^>]*\s)?class="([^"]* )?channel-header( [^"]*)?".*?<div\s([^>]*\s)?id="channel-subheader"')"
if grep -qP '<span\s([^>]*\s)?class="([^"]+ )?yt-channel-title-autogenerated[ "]' <<<"${header}"
then
echo "${url}" >&3
continue
fi
fi
echo "${url}"
done

Loading…
Cancel
Save