@jswork/next-weibo-to-pics
v1.1.2
Published
Sina weibo pics to array.
Downloads
7
Readme
next-weibo-to-pics
Sina weibo response to array.
installation
yarn add @jswork/next-weibo-to-pics
usage
import '@jswork/next-weibo-to-pics';
const options = { baseURL: 'https://tva1.sinaimg.cn' };
const html = `<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript">document.domain="sina.com.cn";</script>
{"code":"A00006","data":{"count":1,"data":"eyJ1aWQiOjM2NjE4MzI4MDMsImFwcCI6Im1pbmlibG9nIiwiY291bnQiOjEsInRpbWUiOjE2MjA4ODIyNTQuNTMzLCJwaWNzIjp7InBpY18xIjp7IndpZHRoIjoyMDAsInNpemUiOjkzODksInJldCI6MSwiaGVpZ2h0IjoyMDAsIm5hbWUiOiJwaWNfMSIsInBpZCI6ImRhNDMyMjYzZ3kxZ3FncHUzdTBhbWoyMDVrMDVrM3loIn19fQ==","pics":{"pic_1":{"width":200,"size":9389,"ret":1,"height":200,"name":"pic_1","pid":"da432263gy1gqgpu3u0amj205k05k3yh"}}}}`;
const items = nx.weiboToPics(html, options);
/*
[
{
width: 200,
size: 9389,
ret: 1,
height: 200,
name: 'pic_1',
pid: 'da432263gy1gqgpu3u0amj205k05k3yh',
format: 'jpg',
url: 'https://tva1.sinaimg.cn/large/da432263gy1gqgpu3u0amj205k05k3yh.jpg'
}
]
*/
license
Code released under the MIT license.