LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General > LinuxQuestions.org Member Success Stories
User Name
Password
LinuxQuestions.org Member Success Stories Just spent four hours configuring your favorite program? Just figured out a Linux problem that has been stumping you for months?
Post your Linux Success Stories here.

Notices


Reply
  Search this Thread
Old 06-24-2019, 09:46 PM   #1
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: Slackware
Posts: 8,944

Rep: Reputation: 3840Reputation: 3840Reputation: 3840Reputation: 3840Reputation: 3840Reputation: 3840Reputation: 3840Reputation: 3840Reputation: 3840Reputation: 3840Reputation: 3840
CLI app to get podcast feed URLs


I've been getting into podcasts recently, and I've noticed that, a) a lot of clients expect you to just give them the RSS feeds that you want to subscribe to, and b) those RSS feeds aren't always easy to find.

So I kludged up a small script to query for them.

Code:
#!/usr/bin/env bash

if [[ "$1" == "" ]]; then
  exit 1
fi

PODCAST=$(http "https://itunes.apple.com/search?media=podcast&term=$1" | jq -r '.results[].collectionName' | fzf --select-1 --exit-0)

if [[ "$PODCAST" == "" ]]; then
  exit
fi

echo "$PODCAST"
http "https://itunes.apple.com/search?media=podcast&term=$PODCAST" | jq -r '.results[0].feedUrl'
Name it "podfeed" and call it like this:

Code:
podfeed "You Must Remember"
That currently gives you a menu of two choices:
  • You Must Remember Manson
  • You Must Remember This

Narrow down the list by typing, or use the arrow keys to make a selection, and press ENTER.

Then you'll see:

Code:
You Must Remember Manson
http://feeds.megaphone.fm/PPY3689373157
Note that this uses a fairly modern pipeline, specifically:

I'll decline to link to the iTunes search API documentation, as all I did was look at what CPod does:

https://github.com/z-------------/CP...ch-podcasts.js

For more ideas on what you can do with FZF, see here:

How FZF and ripgrep improved my workflow
 
Old 06-25-2019, 07:50 AM   #2
individual
Member
 
Registered: Jul 2018
Posts: 208

Rep: Reputation: 155Reputation: 155
That's pretty neat, Dugan. My only question is whether it would be better to store the result of the first search in a variable, that way you don't need to call the same URL again?
Something like this?
Code:
#!/usr/bin/env bash

data="$(<1.txt)"
feedNames="$(<<<"$data" jq '.results[].collectionName')"
<<<"$data" jq -r ".results[] | select(.collectionName == $(fzy <<< "$feedNames")) | .feedUrl"
EDIT: By the way, I use fzy, but it works just the same with fzf.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Cli.Fyi A Tool To Quickly Retrieve Information About eMails, IP Addresses, URLs And Lots More From The CLI Or Browser LXer Syndicated Linux News 0 03-15-2018 03:03 PM
Exporting Amarok podcast URLs LinuxD Linux - Desktop 2 12-07-2009 01:21 AM
Democracy-player? Alternative internet-TV/vidblog/video-podcast feed aggregators? silencestone Slackware 4 12-16-2007 06:55 PM
Looking for RSS & Atom Feed (News Feed)? suse2166 Linux - Software 2 11-16-2006 04:58 PM
how to check urls and stop internet urls in network gface Linux - Networking 5 03-24-2005 09:48 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General > LinuxQuestions.org Member Success Stories

All times are GMT -5. The time now is 09:33 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration