function objls(obj)
{
let objO=obj;
let listK={};
while(obj!=null)
{
Object.getOwnPropertyNames(obj).forEach(i=>{
listK[i]=1;
});
obj=obj.__proto__;
}
let ret=Object.keys(listK);
let oname=objO.constructor.name;
if(oname=="Number")
ret.unshift(objO);
else if(oname=="String")
ret.unshift(objO.substr(0,1000));
else if(oname=="Array")
ret.unshift(objO.slice(0,10).join(","));
ret.unshift(objO.constructor.name);
return ret;
}
2021年7月5日 星期一
2021年7月4日 星期日
Zip/Unzip folder in Node.js
First, install jszip by npm install jszip, then paste the following code
Then you can use genZip("folder/to/zip","abc.zip") and extractZip("abc.zip","folder/to/extract/to") as promises to zip/unzip your folder
You can also pass an Array to genZip's first argument to zip multiple files and folders
2021年1月14日 星期四
Copy to Clipboard
function cbcopy(s){
obj=document.createElement("textarea");
obj.value=(s+"");
document.body.append(obj);
obj.select();
document.execCommand("copy");
obj.remove();
}
2020年6月23日 星期二
Web crawling By Puppeteer @ Node.js - Part 2/2, How to make it work on Android?
Outlines
1. Install ubuntu on Android by AndroNix
2. Install node.js and puppeteer
3. start web crawling
4. advanced adjustments to display chinese characters
2020年6月22日 星期一
Web crawling By Puppeteer @ Node.js - Part 1/2
# Introduction
- Puppeteer is a node.js library that achieves web crawling by an automated chromium browser (chrome open source project)
- Unlike other methods needing to send pure http requests and parse responses yourself, even needing to handle cookies manually, your syntax is simply:
- Launch browser -> emulate real user operations on the web page -> get any data that is reachable by a real user
Web crawling by puppeteer is very simple.
This is part 1/2, in part 2/2 I'll demonstrate how to make it work on Android
# Getting Started
Start by installing:- npm install puppeteer
訂閱:
文章 (Atom)