饥人谷开放 API

所有接口如想使用 https 协议,可把对于后缀是.php 的接口可把 http(s)://api2.jirengu.com 替换成 https://api2.jirengu.com

说明

FM API v2

FM API数据源来自豆瓣 FM,仅供前端爱好者学习交流使用。如冒昧侵权,请联系我们删除 邮箱

获取专辑分类

使用范例:

范例1

http(s)://api2.jirengu.com/fm/v2/getChannels.php

http(s)://api2.jirengu.com/fm/v2/getChannels.php?callback=getChannel

范例2

  $.get('http(s)://api2.jirengu.com/fm/v2/getChannels.php')
   .done(function(channelInfo){
    console.log(channelInfo)
  });

获取随机歌曲

使用范例:

范例1

http(s)://api2.jirengu.com/fm/v2/getSong.php?channel=4

http(s)://api2.jirengu.com/fm/v2/getSong.php?channel=4&callback=getSong

//https协议,可以在 github pages 上使用
https://jirenguapi.applinzi.com/fm/v2/getSong.php?channel=4

范例2

  $.get('http(s)://api2.jirengu.com/fm/v2/getSong.php',{channel: 'public_aaa_bbb'})
   .done(function(song){
    console.log(song)
  });

获取歌词

该接口可不用,获取歌曲信息中已包含歌词链接

使用范例:

范例

http(s)://jirenguapi.applinzi.com/fm/v2/getLyric.php?&sid=1451876&ssid=0ea3

https://jirenguapi.applinzi.com/fm/v2/getLyric.php?&sid=1451876&ssid=0ea3

http(s)://jirenguapi.applinzi.com/fm/v2/getLyric.php?sid=1451876&ssid=0ea3&callback=getLyric

  $.post('http(s)://api2.jirengu.com/fm/getLyric.php',{sid:"758918", ssid:"0ea3"})
   .done(function(lyric){
    console.log(lyric)
  });

天气API

老接口不需要 key

获取当前用户城市

使用范例:

范例1

http(s)://api2.jirengu.com/city.php

http(s)://api2.jirengu.com/city.php?callback=getCity

获取天气简略接口

使用范例:

范例1

http(s)://api2.jirengu.com/getWeather.php

http(s)://api2.jirengu.com/getWeather.php?callback=getWeather

范例2

http(s)://api2.jirengu.com/getWeather.php?city=北京

把线上 markdown 地址转化成在线 PPT

地址: http(s)://md2ppt.jscode.me/

GitHub API

使用说明

作用: 拉取github项目地址中的readme.md,解析成html

使用范例:

范例1

http(s)://api2.jirengu.com/readme2html.php?url=https://github.com/jirengu/server-mock

范例2

  $.get('http(s)://api2.jirengu.com/readme2html.php',{
        url:'https://github.com/jirengu/server-mock'
    }).done(function(tpl){

    $('body').append(tpl)

    //$('pre code').each(function(i, block) {
    //  hljs.highlightBlock(block);
    //});
  });

markdown API

使用说明

作用: 传入markdown文件的线上地址,解析成html

使用范例:

范例1

http(s)://api2.jirengu.com/md2html.php?url=https://raw.githubusercontent.com/jirengu/server-mock/master/README.md

范例2

  $.get('http(s)://api2.jirengu.com/md2html.php',{
        url:'https://raw.githubusercontent.com/jirengu/server-mock/master/README.md'
    }).done(function(tpl){

    $('body').append(tpl)

    $('pre code').each(function(i, block) {
      hljs.highlightBlock(block);
    });
  });

markdown page API

使用说明

作用: 传入markdown文件的线上地址,解析并展示成页面,添加样式

使用范例:

范例1

http(s)://api2.jirengu.com/md2page.php?url=https://raw.githubusercontent.com/jirengu/server-mock/master/README.md