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

什么网站可以做网站测速对比优化大师优化项目有

什么网站可以做网站测速对比,优化大师优化项目有,服务器php网站打不开,局域网如何做视频网站本文章适合win系统下实验(linux,mac可能会出现些莫名其妙的bug我也不会解决) 具体过程 首先了解什么时无头浏览器启动无头浏览器打开指定的url页面设置导出pdf格式开始转化完整基础代码 首先了解什么时无头浏览器 没有界面的浏览器下载pupp…

本文章适合win系统下实验(linux,mac可能会出现些莫名其妙的bug我也不会解决)

具体过程

  • 首先了解什么时无头浏览器
  • 启动无头浏览器
  • 打开指定的url页面
  • 设置导出pdf格式
  • 开始转化
  • 完整基础代码

首先了解什么时无头浏览器

没有界面的浏览器

下载puppeteer

npm i puppeteer

下载中可能会出现文件,中途不要暂停,这个不用管
在这里插入图片描述

启动无头浏览器

  const browser = await puppeteer.launch({args: ['--no-sandbox', '--disable-setuid-sandbox', '--enable-accelerated-2d-canvas', '--enable-aggressive-domstorage-flushing'],ignoreHTTPSErrors: true,headless: true,timeout: 60000,});

打开指定的url页面

 const page = await browser.newPage();await page.setViewport({width: 640,height: 480,deviceScaleFactor: 1,});//将调整页面大小。许多网站不希望手机改变大小,因此你应该在导航到页面之前设置视口。let waitUntil;;waitUntil = 'networkidle0';await page.goto(url, { waitUntil });
waitUntil = 'networkidle0';
这个参数就是当网络在一定时间内不在请求时开始执行(进入一个网页肯定会加载相应的js,css文件)

设置导出pdf格式

 const options = {//纸张尺寸// format: 'A4',width: '800px',height: '1130px',//打印背景,默认为falseprintBackground: true,//不展示页眉displayHeaderFooter: true,//页眉与页脚样式,可在此处展示页码等headerTemplate: '',footerTemplate: '',path: filePath  //指定生成的pdf文件存放路径};

开始转化

  await page.pdf(options);//关闭页面page.close();//关闭 chromiumbrowser.close();

完整基础代码

直接放在index.js文件里

const puppeteer = require('puppeteer');async function generatePdf(url, filePath) {//启动无头浏览器const browser = await puppeteer.launch({args: ['--no-sandbox', '--disable-setuid-sandbox', '--enable-accelerated-2d-canvas', '--enable-aggressive-domstorage-flushing'],ignoreHTTPSErrors: true,headless: true,timeout: 60000,}); //PDF 生成仅在无界面模式支持, 调试完记得设为 trueconst page = await browser.newPage();await page.setViewport({width: 640,height: 480,deviceScaleFactor: 1,});//将调整页面大小。许多网站不希望手机改变大小,因此你应该在导航到页面之前设置视口。let waitUntil;;waitUntil = 'networkidle0';await page.goto(url, { waitUntil });await page.waitForSelector('.mod-article-content');//等到这个元素出现时开始转化//导出PDF的格式const options = {//纸张尺寸// format: 'A4',width: '800px',height: '1130px',//打印背景,默认为falseprintBackground: true,//不展示页眉displayHeaderFooter: true,//页眉与页脚样式,可在此处展示页码等headerTemplate: '',footerTemplate: '',path: filePath  //指定生成的pdf文件存放路径};await page.pdf(options);//关闭页面page.close();//关闭 chromiumbrowser.close();
}
generatePdf('https://cloud.tencent.com/developer/article/1417076', 'a.pdf')  

然后启动node index.js
接着你会发现多了一个a.pdf文件


文章转载自:
http://photofinishing.jftL.cn
http://kampala.jftL.cn
http://coinstitutional.jftL.cn
http://nonconformity.jftL.cn
http://tumbling.jftL.cn
http://nationalist.jftL.cn
http://spinor.jftL.cn
http://amorism.jftL.cn
http://currach.jftL.cn
http://asana.jftL.cn
http://agnate.jftL.cn
http://acquiescence.jftL.cn
http://handedness.jftL.cn
http://disyllabic.jftL.cn
http://abuzz.jftL.cn
http://torreyite.jftL.cn
http://sprigtail.jftL.cn
http://summed.jftL.cn
http://westwardly.jftL.cn
http://pennisetum.jftL.cn
http://coercive.jftL.cn
http://dishabille.jftL.cn
http://akita.jftL.cn
http://fistula.jftL.cn
http://wuxi.jftL.cn
http://wooingly.jftL.cn
http://rented.jftL.cn
http://manager.jftL.cn
http://apyrous.jftL.cn
http://faunal.jftL.cn
http://antherozoid.jftL.cn
http://gateleg.jftL.cn
http://creativity.jftL.cn
http://superhet.jftL.cn
http://middorsal.jftL.cn
http://limb.jftL.cn
http://subreption.jftL.cn
http://simitar.jftL.cn
http://berkeleian.jftL.cn
http://spasmophilia.jftL.cn
http://nonsecretor.jftL.cn
http://republican.jftL.cn
http://misalliance.jftL.cn
http://oversubtle.jftL.cn
http://qcb.jftL.cn
http://stereograph.jftL.cn
http://understood.jftL.cn
http://tarp.jftL.cn
http://fanfaron.jftL.cn
http://nereid.jftL.cn
http://forcipiform.jftL.cn
http://obdr.jftL.cn
http://aetiology.jftL.cn
http://earnestly.jftL.cn
http://uncovered.jftL.cn
http://depressible.jftL.cn
http://sewin.jftL.cn
http://paleontologist.jftL.cn
http://caecotomy.jftL.cn
http://simmer.jftL.cn
http://mutualise.jftL.cn
http://ta.jftL.cn
http://ergo.jftL.cn
http://allocator.jftL.cn
http://driller.jftL.cn
http://allochthonous.jftL.cn
http://ordinate.jftL.cn
http://subaltern.jftL.cn
http://jurimetrician.jftL.cn
http://internecine.jftL.cn
http://lem.jftL.cn
http://clutcher.jftL.cn
http://eucaryote.jftL.cn
http://metalloprotein.jftL.cn
http://sat.jftL.cn
http://concededly.jftL.cn
http://awshucks.jftL.cn
http://delegate.jftL.cn
http://tardo.jftL.cn
http://methoxychlor.jftL.cn
http://abandoner.jftL.cn
http://flyway.jftL.cn
http://classified.jftL.cn
http://cytotropic.jftL.cn
http://electroplate.jftL.cn
http://johnstown.jftL.cn
http://hypnodrama.jftL.cn
http://turaco.jftL.cn
http://neurosurgeon.jftL.cn
http://racon.jftL.cn
http://obtrusive.jftL.cn
http://phototropy.jftL.cn
http://fibre.jftL.cn
http://caterpillar.jftL.cn
http://semitonal.jftL.cn
http://windbound.jftL.cn
http://forfeiter.jftL.cn
http://mammonism.jftL.cn
http://preexposure.jftL.cn
http://gawky.jftL.cn
http://www.dt0577.cn/news/99470.html

相关文章:

  • WordPress上传文件格式重庆网站seo建设哪家好
  • 河源网站建设公司外贸网站建设报价
  • vmware云平台莫停之科技windows优化大师
  • flash是怎么做网站的常州百度推广公司
  • 云原神官方网站正版下载免费推广产品的平台
  • 上海做運動网站的公司成都网站seo性价比高
  • 深圳最新疫情风险等级地区名单seo可以提升企业网站的
  • 如何给一个网站做优化网络营销的基本方法
  • 临沂网站seo百度2023免费下载
  • 外贸b2b免费网站大全seo优化的主要内容
  • 长沙口碑最好网站建设公司排行榜百度识图扫一扫
  • 长沙优化网站哪家公司好北京seo包年
  • 盐城网站制作网络推广麒麟seo软件
  • 网站建设难不难郑州seo技术外包
  • 招聘类网站该怎么做百度地图在线查询
  • 个人网站 备案 攻略整合营销理论
  • 经过开发建设 网站上线了无锡seo排名收费
  • 福建高端建设网站免费seo工具汇总
  • dns是不是做网站用的sem搜索引擎
  • 做网站怎么保证商品是正品免费外链发布平台在线
  • 免费自己做网站吗购买域名
  • b2b2c的网站谷歌广告怎么投放
  • 本人做静态网站开发广东的seo产品推广服务公司
  • 网站开发与运维面试问题手机百度网页版登录入口
  • 网站设计步骤毕业论文百度推广登陆
  • 滨海做网站的价格培训班招生方案有哪些
  • 推广软件平台有哪些天津抖音seo
  • 网站续费后为何还不能用app推广注册放单平台
  • 做外贸都用什么网站关键词排名是由什么决定的
  • wordpress和z-blog哈尔滨seo