|
@@ -31,7 +31,7 @@ class Webshot extends CallableInstance {
|
|
|
|
|
|
private renderWebshot = (url: string, height: number, webshotDelay: number): Promise<string> => {
|
|
private renderWebshot = (url: string, height: number, webshotDelay: number): Promise<string> => {
|
|
const promise = new Promise<{ data: string, boundary: null | number }>(resolve => {
|
|
const promise = new Promise<{ data: string, boundary: null | number }>(resolve => {
|
|
- const width = 1080;
|
|
|
|
|
|
+ const width = 600;
|
|
logger.info(`shooting ${width}*${height} webshot for ${url}`);
|
|
logger.info(`shooting ${width}*${height} webshot for ${url}`);
|
|
this.browser.newPage()
|
|
this.browser.newPage()
|
|
.then(page => {
|
|
.then(page => {
|
|
@@ -45,7 +45,7 @@ class Webshot extends CallableInstance {
|
|
.then(() => page.goto(url))
|
|
.then(() => page.goto(url))
|
|
// hide header, "more options" button, like and retweet count
|
|
// hide header, "more options" button, like and retweet count
|
|
.then(() => page.addStyleTag({
|
|
.then(() => page.addStyleTag({
|
|
- content: 'html{zoom:2}header{display:none!important}path[d=\'M20.207 7.043a1 1 0 0 0-1.414 0L12 13.836 5.207 7.043a1 1 0 0 0-1.414 1.414l7.5 7.5a.996.996 0 0 0 1.414 0l7.5-7.5a1 1 0 0 0 0-1.414z\'],div[role=\'button\']{display: none;}',
|
|
|
|
|
|
+ content: 'header{display:none!important}path[d=\'M20.207 7.043a1 1 0 0 0-1.414 0L12 13.836 5.207 7.043a1 1 0 0 0-1.414 1.414l7.5 7.5a.996.996 0 0 0 1.414 0l7.5-7.5a1 1 0 0 0 0-1.414z\'],div[role=\'button\']{display: none;}',
|
|
}))
|
|
}))
|
|
.then(() => page.waitFor(webshotDelay))
|
|
.then(() => page.waitFor(webshotDelay))
|
|
.then(() => page.addScriptTag({
|
|
.then(() => page.addScriptTag({
|