Use node. js to make a weather plugin for yourself

Source: Internet
Author: User
var request = require (' request ') var url = ' Http://www.baidu.com/home/xman/data/superload ' var cookie = ' Cookie after you log in to Baidu ' var options = {    method: "GET",    Url:url,    QS: {        "type": "Weather",        "Asyn": 1,        "T": New Date (). GetTime ()    },    headers: {        ' user-agent ': ' mozilla/5.0 (Windows NT 6.3; WOW64; rv:34.0) gecko/20100101 firefox/34.0 ',        ' cookie ': Cookie    }};function Callback (Error, response, body) {    if (!error && Response.statuscode = =) {        var info = json.parse (body);        Console.log (info);}    } Request (options, callback);

  

When you log in to Baidu, will not show a weather. We can use this API to make a small plug-in, the above code is very few.

Use node. js to make a weather plugin for yourself

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.