建立应用领域
网络连接
采用Hello.js网络连接
采用Hello.js精简网络连接,facebook和twitter网络连接方式那样。
Hello.js(http://adodson.com/hello.js/)是两个应用程序JavaScript SDK,用作OAuth2证书Web服务项目和允诺它的REST Api。
HelloJS技术标准了方向,并积极响应常用的API,比如Google Data Services、Facebook Graph和Windows Live Connect。它是组件,因此那个条目还在快速增长中。
// 调用,实用性应用领域id hello.init({ facebook: FACEBOOK_CLIENT_ID,windows: WINDOWS_CLIENT_ID }, {redirect_uri:redirect.html}) // 登入 hello.on(auth.login, function(auth){ // 登入获得成功后,以获取采用者重要信息(fb、tw的采用者统计数据有区别) hello( auth.network ).api( /me ).then(function (res) { console.log(res) }) })Facebook登入后以获取的采用者重要信息
{ email: "XX@gmail.com", first_name: "XX", id: "123456", last_name: "XX", name: "XX", picture: "url", thumbnail: "url" }Twitter登入后以获取的采用者重要信息
{ "id": 123456, "id_str": "123456", "name": "XX", "screen_name": "XX", "location": "", "description": "xx", "url": "url", "entities": { "description": { "urls": [] } },"protected": false, "followers_count": 0, "friends_count": 0, "listed_count": 0, "created_at": "Fri Mar 08 03:36:20 +0000 2022", "favourites_count": 0, "utc_offset": null, "time_zone": null, "geo_enabled": false, "verified": false, "statuses_count": 0, "lang": "en", "contributors_enabled": false, "is_translator": false, "is_translation_enabled": false, "profile_background_color": "F5F8FA", "profile_background_image_url": null, "profile_background_image_url_https": null, "profile_background_tile": false, "profile_image_url": "url", "profile_image_url_https": "url", "profile_link_color": "1DA1F2", "profile_sidebar_border_color": "C0DEED", "profile_sidebar_fill_color": "DDEEF6", "profile_text_color": "333333", "profile_use_background_image": true, "has_extended_profile": false, "default_profile": true, "default_profile_image": true, "following": false, "follow_request_sent": false, "notifications": false, "translator_type": "none", "suspended": false, "needs_phone_verification": false, "first_name": "XX", "last_name": "", "thumbnail": "url" }Facebook撷取
触发撷取:
<a href="_javascript:void(0)" @click="fbShare">facebook 撷取</a> fbShare () { letsharePath =// 撷取出去之后别人打开的链接 let title = // 撷取标题 window.open(https://www.facebook.com/sharer/sharer.php?u=+ encodeURIComponent(sharePath) +&t= + encodeURIComponent(title), _blank, toolbar=yes, location=yes, directories=no, status=no, menubar=yes, scrollbars=yes, resizable=no, copyhistory=yes, width=600, height=450, top=100, left=350) }撷取重要信息设置:
撷取出去的样式包含图片,标题,简介
这些重要信息不是撷取的时候设置的,是爬虫直接爬的撷取链接页面head中预先设置好的撷取重要信息,head实用性如下
<meta property="og:locale" content="en-US"> <meta property="og:type" content="website"> <meta property="og:title" content="realme Holi Game"> <meta property="og:image" content="xx.jpg"> <meta property="og:description" content="hello world">Twitter撷取
触发撷取:
<a href="_javascript:void(0)" @click="twShare">Twitter 撷取</a> twShare () { let content = window.open(`https://twitter.com/share?text=${encodeURIComponent(data.title)}&url=${encodeURIComponent(urlStr)}`, _blank, toolbar=yes, location=yes, directories=no, status=no, menubar=yes, scrollbars=yes, resizable=no, copyhistory=yes, width=600, height=450, top=100, left=350) }撷取重要信息设置:
撷取出去的样式包含图片,标题,简介
这些重要信息不是撷取的时候设置的,是爬虫直接爬的撷取链接页面head中预先设置好的撷取重要信息,head实用性如下
<meta name="twitter:title" content="realme Holi Game"> <meta name="twitter:description" content="content"> <meta name="twitter:image" content="xx.jpg"> <meta name="twitter:card" content="summary">