微信小程序云开发实现抓包

**
微信小程序云开发实现抓包 **
需要插件

const cheerio = require("cheerio"); const request = require('superagent'); const Promise = require('bluebird');

实现代码
//豆瓣排行榜 async function getDoubanHot() { let page = await getPage('https://movie.douban.com/chart/'); let $ = cheerio.load(page.text); let random = Math.ceil(Math.random() * 10) let title = $(".indent").find('.item').find('.nbg')[random].attribs.title let image = $(".indent").find('.item').find('.nbg').find('img')[random].attribs.src let desc = $(".indent").find('.item').find('.pl2').find('p[class="pl"]')[random].children[0].data let rating_nums = $(".indent").find('.item').find('.rating_nums')[random].children[0].data let pl = $(".indent").find('.item').find('.star.clearfix').find('.pl')[random].children[0].data let t = desc.substring(0, 4); let time = new Date().getFullYear; if (time - Number(t) <= 0) { t = 0; } return { year: t, average: 1, title, rating_nums, pl, desc, image } }

let dlist = []; try { let page = await getPage(pppUrl + '/index.php?m=vod-search&wd=' + encodeURI(event.name)); let $ = cheerio.load(page.text); getSearchResult($, dlist) let numberString = $('.row').find("div[class='hy-video-head']").find('h4[class="margin-0"]').find('span[class="text-color"]').text().split('”“')[1].replace("”", "") let number = Number(numberString); let count = Math.round(number / 10) if (count > 10) { count = 10 } for (let i = 2; i <= count; i++) { await sleep(50); let page1 = await getPage(pppUrl + '/vod-search-pg-' + i + '-wd-' + encodeURI(event.name) + '.html'); let $1 = cheerio.load(page1.text); getSearchResult($1, dlist) } } catch (err) { //出错拉 } finally { return JSON.stringify(dlist) }

【微信小程序云开发实现抓包】具体项目请去github下载直通车
扫码去小程序查看
微信小程序云开发实现抓包
文章图片

    推荐阅读