홈서버 구축으로 plexmediaserver를 사용하고 있는데 podcast를 들을려고 한다..
안드로이드 앱으로 들어도 되는데 잘 듣던 팥빵이 회원가입을 요구하고 있어서…짜증이 났다..
전에 누가 tedtalks를 자동으로 다운로드 받는 스크립트를 작성했는데, 거기에서 좀 수정을 했다..
3가지 정도 되는데…
1. 지적 대화를 위한 넓고 얕은 지식
2. 이진우의 손에잡히는 경제
3. 파토의 과학과 사람들
4. bbc 6minute english
정도 된다..
원문은 여기에서 다운로드 받았다.
#!/bin/sh # # TEDTalks Downloader # # Copyright (C) 2009 Denver Gingerich # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #cron을 위한 cd cd /home/now0930/ExtHDD2/PODcast/PODcast echo "TEDTalks Downloader v0.1" echo "by Denver Gingerich (http://ossguy.com/)" echo which wget if [ $? -eq 0 ]; then echo "Using wget..." GET_CMD="wget -O" else which curl if [ $? -eq 0 ]; then echo "Using curl..." GET_CMD="curl -L -o" else echo "Could not find wget or curl" exit 2 fi fi echo podcast_address=http://minicast.imbc.com/PodCast/pod.aspx?code=1000671100000100000 FEED=feed_podcast.xml URLS=urls_podcast DIRNAME=이진우_손에잡히는경제 rm -f ${FEED} ${GET_CMD} ${FEED} ${podcast_address} #${GET_CMD} ${FEED} http://minicast.imbc.com/PodCast/pod.aspx?code=1000674100000100000 #${GET_CMD} ${FEED} http://feeds.feedburner.com/tedtalks_video #손에 잡히는 경제 다운로드 주소.. grep 'type="audio/mpeg"' ${FEED} | \ #아래는 다운로드 받을 기간.... grep '201607\|201605' | \ sed -e 's/^ *<enclosure url="\([^"]*\)" type="audio\/mpeg" length="" \/>/\1/g' > ${URLS}; mkdir -p ${DIRNAME} cd ${DIRNAME} for line in `cat ../${URLS}`; do #SIZE=`echo ${line} | cut -d: -f1` URL=`echo ${line}` #URL=`echo ${line} | cut -d: -f2-` FILENAME=`basename ${URL}|tr -d '\r'` echo $URL echo $FILENAME if [ ! -f "${FILENAME}" ]; then # || [ ${SIZE} -ne `ls -l "${FILENAME}" | awk '{print $5}'` ]; then rm -f "${FILENAME}" ${GET_CMD} "${FILENAME}" "${URL}" fi done cd .. #TED talks audio rm -f ${FEED} podcast_address=http://feeds.feedburner.com/TEDTalks_audio ${GET_CMD} ${FEED} ${podcast_address} grep '<media:content' ${FEED} \ | sed -e 's/^.*<media:content url="\([^"]*\)" fileSize="\([^"]*\).*$/\2:\1/g' | cut -d "?" -f 1 \ > ${URLS} mkdir -p TEDtalks cd TEDtalks for line in `cat ../${URLS}`; do SIZE=`echo ${line} | cut -d: -f1` URL=`echo ${line} | cut -d: -f2-` FILENAME=`basename ${URL}` if [ ! -f "${FILENAME}" ]; then # || [ ${SIZE} -ne `ls -l "${FILENAME}" | awk '{print $5}'` ]; then rm -f "${FILENAME}" ${GET_CMD} "${FILENAME}" "${URL}" fi done cd .. DIRNAME=파토의과학 rm -f ${FEED} podcast_address=http://pod.ssenhosting.com/rss/scienceppl/sciencewithpeople.xml ${GET_CMD} ${FEED} ${podcast_address} grep 'type="audio/mpeg"' ${FEED} | \ cut -d "\"" -f2 > ${URLS}; #sed -e 's/^ *<enclosure url="\([^"]*\)" type="audio\/mpeg3" length="" \/>/\1/g' > ${URLS}; mkdir -p ${DIRNAME} cd ${DIRNAME} for line in `cat ../${URLS}`; do #SIZE=`echo ${line} | cut -d: -f1` #echo "출력분" #URL=`echo ${line} | cut -d'"' -f2-` URL=`echo ${line}` FILENAME=`basename ${URL}|tr -d '\r'` #echo ${URL} #echo ${FILENAME} if [ ! -f "${FILENAME}" ]; then # || [ ${SIZE} -ne `ls -l "${FILENAME}" | awk '{print $5}'` ]; then rm -f "${FILENAME}" ${GET_CMD} "${FILENAME}" "${URL}" fi done << 'COMMENT' COMMENT cd .. #BBC 6minute English DIRNAME=Bbc6Min rm -f ${FEED} rm -f ${URLS} podcast_address=http://www.bbc.co.uk/programmes/p02pc9tn/episodes/downloads ${GET_CMD} ${FEED} ${podcast_address} sed -e 's/</\r\n/g' ${FEED}| grep mp3 |\ cut -d "\"" -f4 > ${URLS}; #sed -e 's/^ *<enclosure url="\([^"]*\)" type="audio\/mpeg3" length="" \/>/\1/g' > ${URLS}; mkdir -p ${DIRNAME} cd ${DIRNAME} for line in `cat ../${URLS}`; do #SIZE=`echo ${line} | cut -d: -f1` #echo "출력분" #URL=`echo ${line} | cut -d'"' -f2-` URL=`echo ${line}` FILENAME=`basename ${URL}|tr -d '\r'` #echo ${URL} #echo ${FILENAME} if [ ! -f "${FILENAME}" ]; then # || [ ${SIZE} -ne `ls -l "${FILENAME}" | awk '{print $5}'` ]; then rm -f "${FILENAME}" ${GET_CMD} "${FILENAME}" "${URL}" fi done cd .. #지대넓얕 DIRNAME=지대넓얕 rm -f ${FEED} rm -f ${URLS} podcast_address=http://pod.ssenhosting.com/rss/rrojia2/rrojia2.xml ${GET_CMD} ${FEED} ${podcast_address} xpath -e '//enclosure/@url' ${FEED} |\ cut -d "\"" -f2 > ${URLS} #sed -e 's/</\r\n/g' ${FEED}| grep mp3 |\ #cut -d "\"" -f4 > ${URLS}; mkdir -p ${DIRNAME} cd ${DIRNAME} for line in `cat ../${URLS}`; do #SIZE=`echo ${line} | cut -d: -f1` #echo "출력분" #URL=`echo ${line} | cut -d'"' -f2-` URL=`echo ${line}` FILENAME=`basename ${URL}|tr -d '\r'` #echo ${URL} #echo ${FILENAME} if [ ! -f "${FILENAME}" ]; then # || [ ${SIZE} -ne `ls -l "${FILENAME}" | awk '{print $5}'` ]; then rm -f "${FILENAME}" ${GET_CMD} "${FILENAME}" "${URL}" fi done cd .. #권한 변경.. find ./ -type f -exec chmod 755 {} \;
매일매일 실행하기 귀찮으니, cron에 등록하면 된다.