Code Monkey home page Code Monkey logo

iheart-mplayer's Introduction

IHEART-URL(1) - General Commands Manual

NAME

iheart-url - print the audio stream URL for an iheartradio station

SYNOPSIS

iheart-url [-chiv] [-l terms] [-s terms] [station_id]
iheart-mplayer [-c] [-l terms] [station_id]
iheart-mpv [-c] [-l terms] [station_id]
iheart-vlc [-c] [-l terms] [station_id]

DESCRIPTION

iheart-url fetches the URL for an iHeartRadio station's audio stream from iHeartRadio's API servers and prints it to stdout. It is meant to be used with audio players and the command substitution syntax in most shells, like so:

$ mplayer -novideo "$(iheart-url [station_id])"

iheart-mplayer is a trivial POSIX sh wrapper scripts that does precisely that for the mplayer media player, or for mpv or vlc if it is called by the corresponding names.

The options are as follows:

-c

Disable TLS; all API requests will be done in cleartext, and only cleartext stream URLS will be returned. May prevent any valid stream URL from being returned, in the event that the station has only TLS streams.

-h

Display a help message. Meaningless for wrapper scripts.

-i

Instead of printing the URL for a station, output some human-readable info about it. Meaningless for wrapper scripts.

-l terms

"I'm feeling lucky" search for terms; print the URL of the "best" result according to iHeartRadio's servers.

-s terms

Run a search for terms, outputting vital information like station ID for each result. Meaningless for wrapper scripts.

-v

Increase verbosity level, may be specified multiple times for more verbosity. Useful in conjunction with -s. Meaningless for wrapper scripts.

station_id

Print the URL for this numerical station ID. Station IDs can be obtained with -i or -s.

ENVIRONMENT

MPLAYER_OPTS

MPV_OPTS

VLC_OPTS

Command line arguments for wrapper scripts to pass their players.

EXAMPLES

Print the URL for station ID 5361:

$ iheart-url 5361

Print expanded search results for the term "Sports:"

$ iheart-url -vs Sports

Play the best match for the search term "Classic rock" in mpv (note the use of double quotes to prevent the shell from field-splitting the search term:)

$ iheart-mpv -l "Classic rock"

CAVEATS

While most media players capable of handling network streams will be able to use these URLs, the lack of public documentation concerning iHeartRadio's API precludes any guarantees about the content provided. Also because of the lack of documentation, much of this tool's functionality relies on information gained from deep-packet inspection of official iHeartRadio apps' traffic and on trial and error. The iHeartRadio API has been known to change on occasion and break iheart-url's functionality. Technical documentation derived from this tool's development may be found in its source code and in the 'iheart-api' file in the source distribution.

BUGS

iheart-mplayer, iheart-mpv, and iheart-vlc naively pass all their arguments to iheart-url, and all of iheart-url's stdout output as an argument to the player. Players do not particularly like the output of -h, -i, or -s.

Multiple people have reported intermittent outages of the iHeartRadio API, during which it may return HTTP errors for iheart-url's requests for certain stations.

Python may raise string encoding exceptions if the console does not support UTF-8. Setting PYTHONIOENCODING to something like ":namereplace" in the environment is recommended.

Up-to-date information on any issues can be found on the Github issue tracker: https://github.com/oldlaptop/iheart-mplayer/issues

OpenBSD 6.4 - March 1, 2019

iheart-mplayer's People

Contributors

oldlaptop avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

iheart-mplayer's Issues

unknown stream type

Getting the following on this station

DEBUG: station name: 93 WIBC
DEBUG: call letters: WIBC-FM
DEBUG: location: Indianapolis, IN, US
DEBUG: description: Indy's News Center 93 WIBC
DEBUG: broadcast format: Prov_Emmis
INFO: an unknown stream type is present, please run with -v and submit a github issue
INFO: KeyError instance: 'flv_stream'
DEBUG: full dictionary dump:
DEBUG: {'id': 6057, 'score': 0.0, 'name': '93 WIBC', 'responseType': 'LIVE', 'description': "Indy's News Center 93 WIBC", 'band': 'FM', 'callLetters': 'WIBC-FM', 'logo': 'http://i.iheart.com/v3/re/assets/images/6057.png', 'freq': '93.1', 'cume': 196000, 'countries': 'US', 'streams': {'shoutcast_stream': '', 'pls_stream': 'http://playerservices.streamtheworld.com/pls/WIBCFMAAC.pls', 'stw_stream': 'http://playerservices.streamtheworld.com/api/livestream?version=1.4&mount=WIBCFMAAC', 'secure_pls_stream': 'https://playerservices.streamtheworld.com/pls/WIBCFMAAC.pls', 'flv_stream': ''}, 'isActive': True, 'modified': '1504729234941', 'markets': [{'name': 'INDIANAPOLIS-IN', 'marketId': '87', 'sortIndex': 8, 'city': 'Indianapolis', 'stateId': 18, 'stateAbbreviation': 'IN', 'cityId': 87, 'country': 'US', 'countryId': 1, 'origin': True, 'primary': True}], 'genres': [{'id': 9, 'name': 'News & Talk', 'sortIndex': 43, 'primary': True}], 'feeds': {'site_id': '0', 'feed': 'www.iheart.com/live/6057/'}, 'format': 'Prov_Emmis', 'provider': 'Emmis', 'rds': '93 WIBC', 'website': 'www.wibc.com', 'social': {}, 'adswizz': {'publisher_id': '0', 'adswizzHost': 'false', 'enableAdswizzTargeting': 'false'}}```

unknown stream type is present,KeyError instance: 'pivot_hls_stream'

$ ./iheart-url -v 2525
DEBUG: station name: DC101
DEBUG: call letters: WWDC-FM
DEBUG: location: Washington, DC, US
DEBUG: description: Washington DC's Alternative Rock
DEBUG: broadcast format: ROCKALTERNATIVE
INFO: an unknown stream type is present, please run with -v and submit a github issue
INFO: KeyError instance: 'pivot_hls_stream'
DEBUG: full dictionary dump:
DEBUG: {'format': 'ROCKALTERNATIVE', 'fccFacilityId': '8682', 'score': 0.0, 'band': 'FM', 'adswizzZones': {'display-zone': '38037', 'audio-exchange-zone': '38034', 'audio-fill-zone': '38033', 'audio-zone': '38035', 'optimized-audio-fill-zone': '38036'}, 'streams': {'secure_shoutcast_stream': 'https://c8icy.prod.playlists.ihrhls.com/2525_icy', 'pivot_hls_stream': 'https://us.api.iheart.com/api/v3/adswizzhls/redirect.m3u8?url=https%3A%2F%2Fc8.prod.playlists.ihrhls.com%2F2525%2Fplaylist.m3u8&marketId=42', 'shoutcast_stream': 'http://c8icyelb.prod.playlists.ihrhls.com/2525_icy', 'hls_stream': 'http://c8.prod.playlists.ihrhls.com/2525/playlist.m3u8', 'secure_hls_stream': 'https://c8.prod.playlists.ihrhls.com/2525/playlist.m3u8', 'secure_rtmp_stream': 'rtmp://cp20131.live.edgefcs.net/live/Was_DC_WWDC-FM_OR@152720'}, 'id': 2525, 'genres': [{'name': 'Alternative', 'sortIndex': 16, 'primary': True, 'id': 1}], 'rdsPiCode': '1F10', 'responseType': 'LIVE', 'feeds': {'site_id': '2079', 'feed': 'www.iheart.com/live/2525/'}, 'callLetters': 'WWDC-FM', 'isActive': True, 'callLetterAlias': 'WWDC-FM', 'description': "Washington DC's Alternative Rock", 'modified': '1520430666980', 'markets': [{'stateId': 10, 'cityId': 42, 'stateAbbreviation': 'DC', 'country': 'US', 'sortIndex': 5, 'primary': True, 'countryId': 1, 'city': 'Washington', 'marketId': '42', 'origin': True, 'name': 'WASHINGTON-DC'}], 'logo': 'http://i.iheart.com/v3/re/assets/images/2525.png', 'freq': '101.1', 'name': 'DC101', 'social': {'facebook': 'dc101', 'twitter': 'dc101'}, 'website': 'dc101.iheart.com', 'countries': 'US', 'cume': 900700, 'rds': 'WWDC-FM Washington', 'adswizz': {'publisher_id': '8171', 'adswizzHost': 'false', 'enableAdswizzTargeting': 'false'}, 'provider': 'Clear Channel', 'esid': '1804', 'callLetterRoyalty': 'WWDC-FM'}
no://station/found

Error - Station streams list empty

I use this utility almost daily to listen to radio stations while I work. I hope you're still willing to update the code again.

I'm betting that iheart changed their API in some way again that has caused this problem. Every station I try to play is met with the error "station streams list empty". Looks like that's in parse_iheart_json.py

I'm going to see if I can fix it myself, and if I actually can then I'll submit the fix. But you can probably fix it 10 times faster than I could.

Thanks!

getting multiple tracks from the iheart radio API

Hello,

I know this isn't the official iheart radio API, but I can't find any documentation or support for it.

I have a list of iHeartRadio track_id's and would like to obtain the song and artist names for the tracks.

Is there way to obtain pass multiple iHeartRadio track_id's at once through the iheartRadio API?

I'm currently making multiple calls to the API for a single track as shown below:

https://us.api.iheart.com/api/v1/catalog/getTrackByTrackId?trackId=37561435

Thanks a lot for your time.

probably fails hard on windows

Windows won't have mplayer in $path (or a working which(1)), this probably doesn't work there. Consider adding an option to specify an mplayer binary, and/or detect mplayer binaries where windows puts them.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.