{"size": 674, "ext": "js", "max_stars_repo_path": "bin/oembed_get.js", "max_stars_repo_name": "astro/node-oembed", "max_stars_repo_stars_event_min_datetime": "2015-01-27T14:41:31.000Z", "max_stars_repo_stars_event_max_datetime": "2021-11-11T20:51:58.000Z", "max_issues_repo_path": "bin/oembed_get.js", "max_issues_repo_name": "astro/node-oembed", "max_issues_repo_issues_event_min_datetime": "2015-06-15T11:45:14.000Z", "max_issues_repo_issues_event_max_datetime": "2018-03-11T20:10:13.000Z", "max_forks_repo_path": "bin/oembed_get.js", "max_forks_repo_name": "astro/node-oembed", "max_forks_repo_forks_event_min_datetime": "2015-08-16T21:54:36.000Z", "max_forks_repo_forks_event_max_datetime": "2019-02-06T18:51:38.000Z"}
{"max_stars_count": 22, "max_issues_count": 7, "max_forks_count": 11, "avg_line_length": 22.4666666667, "max_line_length": 97, "alphanum_fraction": 0.6097922849}
#!/usr/bin/env node

var oembed = require('../lib/oembed');

if (process.argv.length < 3) {
    console.error("Usage: " + process.argv.join(' ') + " <URL> [maxwidth=1024] [maxheight=768]");
    process.exit(1);
}

var url = process.argv[2];

var parameters;  /* None by default */
process.argv.slice(3).forEach(function(arg) {
    if (!parameters)
	parameters = {};

    var m;
    if ((m = arg.match(/(.+?)=(.*)/))) {
	parameters[m[1]] = m[2];
    } else
	throw "Unrecognized argument: " + arg;
});

oembed.fetch(url, parameters, function(error, result) {
    if (error)
	console.error(error.message || error.toString());
    else
	console.log(JSON.stringify(result));
});
