当前位置: 首页 > news >正文

股权众筹网站建设个人如何在百度上做广告

股权众筹网站建设,个人如何在百度上做广告,宿舍设计方案ppt,菏泽企业做网站前两篇主要讲解了抖音和快手的图集短视频对去水印解析的云函数开发实践,今天说一些小红书图集解析的云函数实践。 图集短视频去水印云函数开发实践——抖音 图集短视频去水印云函数开发实践——快手 其实都是大差不差的,首先获取到小红书的分享链接&…

前两篇主要讲解了抖音和快手的图集短视频对去水印解析的云函数开发实践,今天说一些小红书图集解析的云函数实践。

图集短视频去水印云函数开发实践——抖音

图集短视频去水印云函数开发实践——快手

其实都是大差不差的,首先获取到小红书的分享链接,然后重定向到原地址,然后直接请求这个地址,获取到网页HTML,直接从中提取,这里比抖音快手还要简单一些。具体代码如下:

async getRedirectUrl(url) {try {const response = await this.curl(url, {method: "GET",headers: this.headers,followRedirect: false,});return this.safeGet(response, 'headers.location', url);} catch (error) {console.error("获取重定向URL时出错:", error);throw error;}}async getHtml(url) {try {const response = await this.curl(url, {headers: this.headers,dataType: "text",});return this.safeGet(response, 'data', null);} catch (error) {console.error("获取网页内容失败:", error);return null;}}parseHtml(html) {const jsonMatch = html.match(/<script>window\.__INITIAL_STATE__=(.*?)<\/script>/);if (!jsonMatch || jsonMatch.length < 2) {console.error("无法找到笔记信息");return null;}try {let jsonString = jsonMatch[1].replace(/undefined/g, "null");const data = JSON.parse(jsonString);const noteId = Object.keys(this.safeGet(data, 'note.noteDetailMap', {}))[0];if (!noteId) {console.error("无法找到笔记ID");return null;}const noteData = this.safeGet(data, `note.noteDetailMap.${noteId}.note`, null);if (!noteData) {console.error("无法获取笔记数据");return null;}const result = {title: this.safeGet(noteData, 'title', ''),desc: this.safeGet(noteData, 'desc', ''),type: this.safeGet(noteData, 'type', ''),user: {nickname: this.safeGet(noteData, 'user.nickname', ''),avatar: this.safeGet(noteData, 'user.avatar', ''),userId: this.safeGet(noteData, 'user.userId', ''),},time: this.safeGet(noteData, 'time', ''),likes: this.safeGet(noteData, 'interactInfo.likedCount', '0'),comments: this.safeGet(noteData, 'interactInfo.commentCount', '0'),collects: this.safeGet(noteData, 'interactInfo.collectedCount', '0'),view_count: this.safeGet(noteData, 'interactInfo.viewCount', '0'),share_count: this.safeGet(noteData, 'interactInfo.shareCount', '0'),platform: "xiaohongshu",};if (noteData.type === "video") {result.video = {url: this.safeGet(noteData, 'video.media.stream.h264.0.masterUrl', ''),cover: this.safeGet(noteData, 'video.cover.url', ''),};} else {result.images = this.safeGet(noteData, 'imageList', []).map((img) => ({url: this.safeGet(img, 'urlDefault', '') || this.safeGet(img, 'url', ''),width: this.safeGet(img, 'width', 0),height: this.safeGet(img, 'height', 0),}));}return result;} catch (error) {console.error("解析笔记信息失败:", error);return null;}}// 辅助方法:将字符串解析为数字parseNumber(value) {if (typeof value === "number") return value;if (!value) return 0;const num = parseInt(value.replace(/[^0-9]/g, ""));return isNaN(num) ? 0 : num;}safeGet(obj, path, defaultValue = '') {return path.split('.').reduce((acc, part) => {if (acc && typeof acc === 'object' && part in acc) {return acc[part];}return defaultValue;}, obj);}

没那么多废话了,看代码应该就可以明白了,不明白的留言问就好了。

http://www.hkea.cn/news/70414/

相关文章:

  • 深圳网站建设 设计搜索引擎的工作原理是什么?
  • 在线网站设计百度收录查询方法
  • 最新体育新闻足球百度seo收费
  • 手机网站做跳转好吗个人在百度上发广告怎么发
  • 民宿网站的建设最近热搜新闻事件
  • 企业网站建设的核心是企业推广视频
  • 设计素材网站蜂产品推广文章
  • wordpress站点描述seo哪个软件好
  • 澳门服务器做网站需要备案吗百度ai人工智能平台
  • 做化验的在哪个网站里投简历河南网站关键词优化
  • 百度网址大全网站大全网络整合营销方案ppt
  • 海阳市建设工程交易中心网站品牌推广的作用
  • 江西省住房和城乡建设网站成都网站优化seo
  • java资源网站云优化
  • 小程序源码大全网络seo关键词优化技巧
  • 服务佳的小企业网站建设ip子域名大全
  • 网页与制作唐山seo推广公司
  • 自己做的网站怎么弄到网上在线网页制作
  • 电商网站 设计方案百度的排名规则详解
  • 福建省建设厅网站余外链链接平台
  • 广告营销网站市场推广方案
  • 徐州企业做网站软文是什么文章
  • 网站代码备份如何优化seo
  • 百度网站公司信息推广怎么做天津做网站的网络公司
  • wordpress在线pdfseo百度站长工具查询
  • 太仓网站建设有限公司网站设计公司怎么样
  • 网站去哪做在线crm软件
  • 做360手机网站快速汕头seo排名收费
  • 网站建设总做总结宜兴百度推广公司
  • 做毕业网站的周记外贸建站优化