summaryrefslogtreecommitdiff
path: root/angel.sh
blob: 1a353fae0346bac3965a8c4f359defd8d3a0e794 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/bin/sh

TODAY=$(date '+%d/%m/%y')
VIDEO_ID=$(
    curl -s https://www.youtube.com/playlist\?list\=PLtk0IJ09y34XS044BgNOsFvd8FD4mPYQY \
        | sed -n '/var ytInitialData/ { s/^.*ytInitialData = //; s/;.*$//; p }' \
        | jq -r ".contents.twoColumnBrowseResultsRenderer.tabs[0].tabRenderer.content.sectionListRenderer.contents[0].itemSectionRenderer.contents[0].playlistVideoListRenderer.contents[] | select(.playlistVideoRenderer.title.runs[0].text == \"Informativo matinal express [$TODAY]\") | .playlistVideoRenderer.videoId")

if [ -z "$VIDEO_ID" ]; then
    exit 0
fi

echo -e "Informativo matinal para ahorraros tiempo [$TODAY]\nhttps://www.youtube.com/watch?v=$VIDEO_ID"