Browse Source

fix style, reduce working timeout

Mike L 3 years ago
parent
commit
addf190d77
3 changed files with 5 additions and 5 deletions
  1. 1 1
      .eslintrc.js
  2. 1 1
      dist/twitter.js
  3. 3 3
      src/twitter.ts

+ 1 - 1
.eslintrc.js

@@ -71,11 +71,11 @@ module.exports = {
           delimiter: 'comma',
           requireLast: false,
         },
+        multilineDetection: 'last-member',
         overrides: {
           interface: {
             multiline: {
               delimiter: 'semi',
-              requireLast: true,
             },
           },
         },

+ 1 - 1
dist/twitter.js

@@ -206,7 +206,7 @@ class default_1 {
                         page = newPage;
                         const startTime = new Date().getTime();
                         const getTimerTime = () => new Date().getTime() - startTime;
-                        const getTimeout = () => isWaitingForLogin ? 0 : Math.max(90000, this.webshotDelay - getTimerTime());
+                        const getTimeout = () => isWaitingForLogin ? 0 : Math.max(5000, this.webshotDelay / 2 - getTimerTime());
                         return page.context().addCookies(this.webshotCookies)
                             .then(() => page.goto(url, { waitUntil: 'load', timeout: getTimeout() }))
                             .then(response => {

+ 3 - 3
src/twitter.ts

@@ -209,8 +209,8 @@ type IgGraphQLTimelineMediaNode = {
   {__typename: 'GraphImage'} |
   {__typename: 'GraphSidecar', edge_sidecar_to_children: {
     edges: {node: (IgGraphQLTimelineMediaNode & {__typename: 'GraphImage'})}[],
-  }, } |
-  {__typename: 'GraphVideo', video_url: string, product_type?: 'igtv' }
+  }} |
+  {__typename: 'GraphVideo', video_url: string, product_type?: 'igtv'}
 );
 
 export type IgGraphQLUser = {
@@ -393,7 +393,7 @@ export default class {
             page = newPage;
             const startTime = new Date().getTime();
             const getTimerTime = () => new Date().getTime() - startTime;
-            const getTimeout = () => isWaitingForLogin ? 0 : Math.max(90000, this.webshotDelay - getTimerTime());
+            const getTimeout = () => isWaitingForLogin ? 0 : Math.max(5000, this.webshotDelay / 2 - getTimerTime());
             return page.context().addCookies(this.webshotCookies)
               .then(() => page.goto(url, {waitUntil: 'load', timeout: getTimeout()}))
               .then(response => {