Skip to content

Instantly share code, notes, and snippets.

@ENDsoft233
Last active February 7, 2021 11:34
Show Gist options
  • Save ENDsoft233/f95785e2716ae079adc38814222a0290 to your computer and use it in GitHub Desktop.
Save ENDsoft233/f95785e2716ae079adc38814222a0290 to your computer and use it in GitHub Desktop.
jump to the latest bing pic url
const express = require('express')
const app = express()
const bodyP = require('body-parser')
const axios = require('axios')
app.use(bodyP.json())
app.get('/', async (req, res) => {
// 直接读主页 let r = await axios({method: 'get',url: 'https://cn.bing.com/'});
//'https://cn.bing.com' + r.data.substring(r.data.indexOf(";background-image:url(/th?id=")+22,r.data.indexOf("); }.hp_sw_logo{float"))
let r = await axios({method: 'get',url: 'https://bing.com/HPImageArchive.aspx?format=js&idx=0&n=1'})
//'https://cn.bing.com' + r.data.images[0].url
res.writeHead(302,{'Location': 'https://cn.bing.com' + r.data.images[0].url})
res.end()
})
app.listen(9000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment