Last active
February 7, 2021 11:34
-
-
Save BH4HPA/f95785e2716ae079adc38814222a0290 to your computer and use it in GitHub Desktop.
jump to the latest bing pic url
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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