http://api.jirengu.com
替换成 https://jirenguapi.applinzi.com
作用: 拉取github项目地址中的readme.md,解析成html
http://api.jirengu.com/readme2html.php
url
: github项目地址
使用范例:
范例1
http://api.jirengu.com/readme2html.php?url=https://github.com/jirengu/server-mock
范例2
$.get('http://api.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文件的线上地址,解析成html
http://api.jirengu.com/md2html.php
url
: markdwon文件线上地址
使用范例:
范例1
http://api.jirengu.com/md2html.php?url=https://raw.githubusercontent.com/jirengu/server-mock/master/README.md
范例2
$.get('http://api.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文件的线上地址,解析并展示成页面,添加样式
http://api.jirengu.com/md2page.php
url
: markdwon文件线上地址
使用范例:
范例1
http://api.jirengu.com/md2page.php?url=https://raw.githubusercontent.com/jirengu/server-mock/master/README.md
FM API数据源来自百度 FM,仅供前端爱好者学习交流使用。如冒昧侵权,请联系我们删除 邮箱
http://api.jirengu.com/fm/getChannels.php
使用范例:
范例1
http://api.jirengu.com/fm/getChannels.php
http://api.jirengu.com/fm/getChannels.php?callback=getChannel
范例2
$.get('http://api.jirengu.com/fm/getChannels.php')
.done(function(channelInfo){
console.log(channelInfo)
});
http://api.jirengu.com/fm/getSong.php
使用范例:
范例1
http://api.jirengu.com/fm/getSong.php?channel=4
http://api.jirengu.com/fm/getSong.php?channel=4&callback=getSong
//https协议,可以在 github pages 上使用
https://jirenguapi.applinzi.com/fm/getSong.php?channel=4
范例2
$.get('http://api.jirengu.com/fm/getSong.php',{channel: 'public_aaa_bbb'})
.done(function(song){
console.log(song)
});
http://api.jirengu.com/fm/getLyric.php
或者 https://jirenguapi.applinzi.com/fm/getLyric.php
使用范例:
范例
http://jirenguapi.applinzi.com/fm/getLyric.php?&sid=1451876
https://jirenguapi.applinzi.com/fm/getLyric.php?&sid=1451876
http://jirenguapi.applinzi.com/fm/getLyric.php?sid=1451876&callback=getLyric
$.post('http://api.jirengu.com/fm/getLyric.php',{sid:"758918"})
.done(function(lyric){
console.log(lyric)
});
查看测试页面
需要 key 的同学请联系班主任 hungervalley ,该接口仅限饥人谷学员使用。非谷里的学员使用后面的老接口
http(s)://weixin.jirengu.com/weather
beijing
、杭州
、南京市
http://weixin.jirengu.com/weather?key=你的key
http://weixin.jirengu.com/weather?location=杭州&key=你的key
{
"status": "OK",
"weather": [{
"city_name": "杭州",
"city_id": "CHZJ000000",
"last_update": "2017-07-31T16:20:00+08:00",
"now": {
"text": "多云",
"code": "4",
"temperature": "35",
"feels_like": "35",
"wind_direction": "东南",
"wind_speed": "27.36",
"wind_scale": "4",
"humidity": "52",
"visibility": "25.50",
"pressure": "993",
"pressure_rising": "未知",
"air_quality": {
"city": {
"aqi": "28",
"pm25": "12",
"pm10": "28",
"so2": "8",
"no2": "13",
"co": "0.682",
"o3": "89",
"last_update": "2017-07-31T15:00:00+08:00",
"quality": "优"
},
"stations": null
},
"alarms": []
},
"today": {
"sunrise": "05:17 AM",
"sunset": "06:56 PM",
"suggestion": {
"dressing": {
"brief": "炎热",
"details": "天气炎热,建议着短衫、短裙、短裤、薄型T恤衫等清凉夏季服装。"
},
"uv": {
"brief": "中等",
"details": "属中等强度紫外线辐射天气,外出时建议涂擦SPF高于15、PA+的防晒护肤品,戴帽子、太阳镜。"
},
"car_washing": {
"brief": "不宜",
"details": "不宜洗车,未来24小时内有雨,如果在此期间洗车,雨水和路上的泥水可能会再次弄脏您的爱车。"
},
"travel": {
"brief": "一般",
"details": "有降水,气温也较高,风稍大,能缓解湿热的感觉。外出旅游请注意防暑降温,并记得出门要携带雨具。"
},
"flu": {
"brief": "少发",
"details": "各项气象条件适宜,发生感冒机率较低。但请避免长期处于空调房间中,以防感冒。"
},
"sport": {
"brief": "较不宜",
"details": "有降水,且风力较强,气压较低,推荐您在室内进行低强度运动;若坚持户外运动,须注意避雨防风。"
},
"restriction": {
"brief": "尾号限行",
"details": "3,7"
}
}
},
"future": [{
"date": "2017-07-31",
"high": "35",
"low": "29",
"day": "周一",
"text": "阵雨/阵雨",
"code1": "10",
"code2": "10",
"cop": "",
"wind": "风力3级"
}, {
"date": "2017-08-01",
"high": "35",
"low": "28",
"day": "周二",
"text": "阵雨/多云",
"code1": "10",
"code2": "4",
"cop": "",
"wind": "风力4级"
}, {
"date": "2017-08-02",
"high": "36",
"low": "29",
"day": "周三",
"text": "阵雨/多云",
"code1": "10",
"code2": "4",
"cop": "",
"wind": "风力2级"
}, {
"date": "2017-08-03",
"high": "35",
"low": "28",
"day": "周四",
"text": "阵雨/晴",
"code1": "10",
"code2": "1",
"cop": "",
"wind": "风力2级"
}, {
"date": "2017-08-04",
"high": "35",
"low": "28",
"day": "周五",
"text": "阵雨/多云",
"code1": "10",
"code2": "4",
"cop": "",
"wind": "风力2级"
}, {
"date": "2017-08-05",
"high": "36",
"low": "28",
"day": "周六",
"text": "阵雨/多云",
"code1": "10",
"code2": "4",
"cop": "",
"wind": "风力2级"
}, {
"date": "2017-08-06",
"high": "36",
"low": "30",
"day": "周日",
"text": "阵雨/阵雨",
"code1": "10",
"code2": "10",
"cop": "",
"wind": "风力2级"
}, {
"date": "2017-08-07",
"high": "35",
"low": "27",
"day": "周一",
"text": "小雨/小雨",
"code1": "13",
"code2": "13",
"cop": "",
"wind": "风力2级"
}, {
"date": "2017-08-08",
"high": "33",
"low": "25",
"day": "周二",
"text": "小雨/小雨",
"code1": "13",
"code2": "13",
"cop": "",
"wind": "风力2级"
}, {
"date": "2017-08-09",
"high": "29",
"low": "23",
"day": "周三",
"text": "阴/多云",
"code1": "9",
"code2": "4",
"cop": "",
"wind": "风力2级"
}]
}]
}
其中 code 代表天气码,对应规则如下
其中天气码对应的图片和建议图片可用如下规则拼装:
var codeImg = `//weixin.jirengu.com/images/weather/code/${data.weather[0].now.code}.png`
var suggestionImg = `//weixin.jirengu.com/images/weather/suggestion/${data.weather[0].today.suggestion.dressing}.png`
http(s)://weixin.jirengu.com/weather/future24h
beijing
、杭州
、南京市
http://weixin.jirengu.com/weather/future24h?key=你的key
http://weixin.jirengu.com/weather/future24h?location=hangzhou&key=你的key
{
"status":"OK",
"hourly":[
{
"text":"阵雨",
"code":"10",
"temperature":"27",
"time":"2018-04-02T17:00:00+08:00"
},
{
"text":"阵雨",
"code":"10",
"temperature":"26",
"time":"2018-04-02T18:00:00+08:00"
},
...
]}
老接口不需要 key
http://api.jirengu.com/city.php
使用范例:
范例1
http://api.jirengu.com/city.php
http://api.jirengu.com/city.php?callback=getCity
http://api.jirengu.com/getWeather.php
使用范例:
范例1
http://api.jirengu.com/getWeather.php
http://api.jirengu.com/getWeather.php?callback=getWeather
范例2
http://api.jirengu.com/getWeather.php?city=北京
用于把用markdown编辑器编辑的线上文章转换成 markdown 源码
地址: http://html2md.jscode.me/
地址: http://md2ppt.jscode.me/
API版权归饥人谷所有,仅供学习交流使用,转载自http://api.jirengu.com/