albertincx / formatbot1 Goto Github PK
View Code? Open in Web Editor NEWMake instant view easily and fast, from any article on the internet in the best messenger ever Telegram
License: GNU General Public License v3.0
Make instant view easily and fast, from any article on the internet in the best messenger ever Telegram
License: GNU General Public License v3.0
Anyone who wants to run this program in the local area network or China(GFW), should modify these places:
...
var httpsAgent = require('socks5-https-client/lib/Agent');
...
const opts = {
channelMode: true,
telegram: {
agent: new httpsAgent({
socksHost: '127.0.0.1', // Defaults to 'localhost'.
socksPort: 1085, // Defaults to 1080.
}),
},
};
...
var httpsAgent = require('socks5-https-client/lib/Agent');
...
return fetch('https://api.telegra.ph/createPage', {
body: JSON.stringify(body),
method: 'POST',
headers: { 'content-type': 'application/json' },
agent: new httpsAgent({
socksHost: '127.0.0.1', // Defaults to 'localhost'.
socksPort: 1085, // Defaults to 1080.
})
})
@mozilla/readability is better than @postlight/mercury-parser
here is an example page: https://www.douban.com/people/166039423/status/3594363157/
@mozilla/readability
can get main content but @postlight/mercury-parser
can't.
var fs = require('fs')
var { Readability } = require('@mozilla/readability')
var Mercury = require('@postlight/mercury-parser')
var { JSDOM } = require('jsdom')
// source html is from: https://www.douban.com/people/166039423/status/3594363157/
var html = fs.readFileSync('t.html', 'utf8')
var doc = new JSDOM(html)
var reader = new Readability(doc.window.document)
var article = reader.parse()
console.log('mozilla_____', article)
Mercury.parse(
'https://www.douban.com/people/166039423/status/3594363157/',
{
html,
}
)
.then((res) => {
console.log('mercury_____', res)
})
.catch((err) => {
console.log('mercury_____', err)
})
InstantViewBot | availableOne true
InstantViewBot | elTime 223
InstantViewBot | 223s, 214ms test1DEV
InstantViewBot | queue job undefined
InstantViewBot | reset start2
InstantViewBot | merc
InstantViewBot | before san 349
InstantViewBot | length 70
InstantViewBot | domed 126
InstantViewBot | Error: empty ivlink
InstantViewBot | at Object.makeIvLink (/app/src/api/utils/ivMaker.js:45:11)
InstantViewBot | at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
InstantViewBot | at async jobMessage (/app/src/api/routes/format/index.js:434:11)
InstantViewBot | error = broken https://mp.weixin.qq.com/s/xxxxxxx Error: empty ivlink
how to fix it?
Thanks!
Setting allowed users of the bot to avoid too much server traffic.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.