Skip to content
This repository has been archived by the owner on Apr 10, 2021. It is now read-only.

FIP changed their API #5

Open
saveman71 opened this issue Jul 10, 2019 · 8 comments
Open

FIP changed their API #5

saveman71 opened this issue Jul 10, 2019 · 8 comments

Comments

@saveman71
Copy link

saveman71 commented Jul 10, 2019

FIP changed their website this week, and with it their API. It's now a graphql endpoint:

https://www.fip.fr/latest/api/graphql?operationName=Now&variables=%7B%22bannerPreset%22%3A%22600x600-noTransform%22%2C%22stationId%22%3A7%2C%22previousTrackLimit%22%3A3%7D&extensions=%7B%22persistedQuery%22%3A%7B%22version%22%3A1%2C%22sha256Hash%22%3A%228a931c7d177ff69709a79f4c213bd2403f0c11836c560bc22da55628d8100df8%22%7D%7D

The variables param decodes to:

{"bannerPreset":"600x600-noTransform","stationId":69,"previousTrackLimit":3}

And the extensions:

{"persistedQuery":{"version":1,"sha256Hash":"8a931c7d177ff69709a79f4c213bd2403f0c11836c560bc22da55628d8100df8"}}

The extensions param seems to be mandatory, as changing one char in the SHA hash says "persisted query not found".

The main FIP station id is 7.

The repsonse is:

{
    "data": {
        "now": {
            "__typename": "Now",
            "playing_item": {
                "__typename": "TimelineItem",
                "title": null,
                "subtitle": null,
                "cover": null,
                "start_time": 0,
                "end_time": 0
            },
            "program": null,
            "song": null,
            "server_time": 1562752366,
            "next_refresh": 1562752376,
            "mode": "program"
        },
        "previousTracks": {
            "__typename": "HistoryCursor",
            "edges": [
                {
                    "__typename": "TimeLineItemEdge",
                    "node": {
                        "__typename": "TimelineItem",
                        "title": "Camille",
                        "subtitle": "Pâle septembre",
                        "start_time": 1562752070,
                        "cover": "https://cdns-images.dzcdn.net/images/cover/9bfc2800990b096aefce6ee9855702fa/1000x1000-000000-80-0-0.jpg"
                    }
                },
                {
                    "__typename": "TimeLineItemEdge",
                    "node": {
                        "__typename": "TimelineItem",
                        "title": "Nola Is Calling",
                        "subtitle": "Downtown",
                        "start_time": 1562751858,
                        "cover": "https://cdns-images.dzcdn.net/images/cover/e37d01ecbb2f4fc760ff340a2eedb98d/1000x1000-000000-80-0-0.jpg"
                    }
                },
                {
                    "__typename": "TimeLineItemEdge",
                    "node": {
                        "__typename": "TimelineItem",
                        "title": "Quatuor Debussy",
                        "subtitle": "Midi Do Majeur - pour quatuor à cordes et vibraphone",
                        "start_time": 1562751691,
                        "cover": null
                    }
                }
            ]
        },
        "nextTracks": [
            {
                "__typename": "TimelineItem",
                "title": "Rene Aubry",
                "subtitle": "Mémoires du futur",
                "start_time": 1562752284,
                "cover": "https://cdns-images.dzcdn.net/images/cover/6c5a7e023e399e995d79f2c90407203a/1000x1000-000000-80-0-0.jpg"
            }
        ]
    }
}
@dest4
Copy link
Member

dest4 commented Jul 11, 2019

Thanks for the nice bug report. This should be fixed in cd05284.

@dest4
Copy link
Member

dest4 commented Jul 11, 2019

Updated on NPM as well, with version 0.1.38 https://www.npmjs.com/package/webradio-metadata?activeTab=versions

@saveman71
Copy link
Author

Just saw that you didn't change the calls for the other "channels" of fip, but just letting you know it's broken as well! In the end I ended up crafting my own solution to my problem: https://github.com/saveman71/fip-to-spotify

@maartenlangeveld
Copy link

@saveman71
Thanks, I wrote a script to retrieve metadata to use with upmpdcli mpd controller.
Do you know if there are also new api's available for the other Radio France stations?

For Mouv' the url : https://www.mouv.fr/latest/api/graphql exists but it probably needs a different SHA hash since I cannot connect using the FIP parameters. Do you know?

Would be nice if there's also new api support for France Inter, France Info, France Culturelle and the France Music stations.

@saveman71
Copy link
Author

I had retrieved the SHA by inspecting the fip website requests, I guess you can do the same with moov's website?

@maartenlangeveld
Copy link

@saveman71
Thanks for your quick response and advice !How can I inspect those website requests? Is it easy to do?

@saveman71
Copy link
Author

@maartenlangeveld
Copy link

Thanks again! I will go and read/view.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants