Article 6KK1J YouTube script stopped working.

YouTube script stopped working.

by
gilesaj001
from LinuxQuestions.org on (#6KK1J)
I am not sure if anyone here knows about Youtube scripting but the part of this script that might not be working is the this part Code:sed "s/.*\?v=\([^\"]*\)\".*/\1/g")I have been using a script to find the last video uploaded to my account for a few years. For about the last week I have had to manually add the video id to am embed code because the code did not find the video ID.

Has there been a change that I missed. The code I use is below.

Code:#!/bin/bash
#
# Script to find last video id from my channel and create an embed code to put in a file.
# Need to replace the Working directory and Your channel id for this to work
#

date

# work from
cd working directory
# Define RSS feed for your channel
URL="https://www.youtube.com/feeds/videos.xml?channel_id="Your Channel ID"
videoid=$(curl -s $URL | grep "/watch?v=" | head -1 | sed "s/.*\?v=\([^\"]*\)\".*/\1/g")
echo $videoid
echo Last Video ID = $videoid
s="<center><iframe width=\"640\" height=\"480\""
s="$s src=\"https://www.youtube.com/embed/${videoid}?feature=player_embedded\""
s="$s frameborder=\"0\" allowfullscreen></iframe></center>"

echo "$s" > youtube-iframe.php

echo Copy complete and Youtube-iframe file copied over to html
date
cp youtube-iframe.php "web site folder"
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments