LinuxQuestions.org
Help answer threads with 0 replies.
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: distro hopper
Posts: 11,198

Rep: Reputation: 5307Reputation: 5307Reputation: 5307Reputation: 5307Reputation: 5307Reputation: 5307Reputation: 5307Reputation: 5307Reputation: 5307Reputation: 5307Reputation: 5307
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: 315
Blog Entries: 1

Rep: Reputation: 233Reputation: 233Reputation: 233
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.
Old 06-27-2022, 06:32 PM   #3
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,198

Original Poster
Rep: Reputation: 5307Reputation: 5307Reputation: 5307Reputation: 5307Reputation: 5307Reputation: 5307Reputation: 5307Reputation: 5307Reputation: 5307Reputation: 5307Reputation: 5307
I wrote another implementation using skim. This one will just give you a prompt and an autocomplete. It's slightly less responsive because it's sending a request to itunes with each keystroke.

pdfd script to make it work:
Code:
#!/usr/bin/env bash

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

http "https://itunes.apple.com/search?media=podcast&term=$1" | jq -r '.results[].collectionName'
The new podfeed script you actually run:
Code:
#!/usr/bin/env bash

PODCAST=$(sk --ansi -i -c 'pdfd "{}" &')

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

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

echo "$URL" "$PODCAST"
And do you want to know what else I did? I wrote my own podcast aggregator, Podfeeds.

Last edited by dugan; 06-27-2022 at 09:08 PM.
 
  


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 04:44 AM.

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
Open Source Consulting | Domain Registration