简体   繁体   中英

Meteor Invoking 404 Error

I'm using cheerio to get the html of a website, and when the website link does not exist (404), meteor.call returns an error instead of proceeding. However, because there are two potential ways the website is formatted for each date, I want to check both and not have meteor throw the 404 error. How should I approach this?

For example,

    result2 = Meteor.http.get("http://dining.columbia.edu/43week-ten-friday-breakfast-fbc");
    $ = cheerio.load(result2.content);
    menu2 = $('#main-wrapper').text();

the link returns a page not found error, which is fine- because if the page is not found, I still want to retrieve the html.

Thanks for your help.

There is no Meteor.http.get . You need to call the HTTP.get method.

See the documentation - http://docs.meteor.com/#/full/http_get

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM