脚本到移动设备适合性测试 [英] Script to Mobile-Friendly test

查看:207
本文介绍了脚本到移动设备适合性测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想编写一个shell / python脚本,它将检查网站是否适合移动设备。使用浏览器可以轻松地访问 -

I wanted to write a shell/python script which will check if a website is mobile friendly or not. Using browser this can be easily done by visiting-

https://www.google.com/webmasters/tools/mobile-friendly/?url=<website_addr>

例如.-

https://www.google.com/webmasters/tools/mobile-friendly/?url=http://facebook.com

我试图通过 curl, wget lynx 命令,但它没有工作。

I tried fetching the content through curl, wget, lynx commands but it did not worked.

我如何做?

推荐答案

在@TimberlakeCoding& @MartijnPieters。这是 -

Solved it myself, with help of @TimberlakeCoding & @MartijnPieters. Here it is-

$ wget -q -O - https://www.googleapis.com/pagespeedonline/v3beta1/mobileReady?url=http://facebo‌​ok.com | grep "\"pass\": true" 

如果退出状态代码为0,意味着网站是移动友好的,否则。

If the exit status code is 0, that means website is mobile friendly else not.

希望它帮助别人!
感谢

Hope it helps someone! Thanks

这篇关于脚本到移动设备适合性测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆