Git Product home page Git Product logo

site-recorder's Introduction

site-recorder

Build Status

Why

site-recorder is a CLI tool for creating comparable image/video artefact. You can pass url and get GIF animation or video loading passed website from the first network request till time to interactive. It's not possible to write real video with for ex. WebRTC, because in that case we have to wait when our script will be loaded. Instead, we are using puppeteer and generated trace.json to get screenshots which demonstrate how site is loading.

Example: http://ronnyr34.wixsite.com/mysite-1

Example

npx site-recorder -gif https://google.com https://wix.com

The result is recorded video and gif-animation of loading passed url.

Custom script example:

npx site-recorder -gif --custom-script ../src/examples/long-wait-task.js

Tech

site-recorder uses a number of open source projects to work properly:

  • puppeteer - Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the DevTools Protocol.
  • Commander.js - The complete solution for node.js command-line interfaces.
  • ffmpeg - A complete, cross-platform solution to record, convert and stream audio and video.
  • fluent-ffmpeg - This library abstracts the complex command-line usage of ffmpeg into a fluent, easy to use node.js module.
  • gif-encoder - Streaming GIF encoder

And of course site-recorder itself is open source with a public repository on GitHub.

Prerequisites

site-recorder requires:

  • Node.js v8+;
  • ffmpeg installed (for mac os: brew install ffmpeg).

Usage

Usage: site-recorder [options] <url1 ...> <url2 ...>

Options:

Option Description
-v,--version output the version number
-d,--debug see full error messages, mostly for debugging
-gif,--generate-gif generate gif as additional output
-W, --resolution-width [width] define the resolution width in the screen recording
-H, --resolution-height [height] define the resolution height in the screen recording
-D, --device [device] define the device that will run the screen recording (Override resolution param
-N, --network [network] define the throttler that will emulate network slowdown
-t,--timeout [navigation-timeout] navigation timeout for loading event in puppeteer (default: 30000)
-cs, --custom-script [path-to-file] add path to custom script that will execute once page is loaded (receives page as argument)
-bw, --disable-colors minimize color and styling usage in output
-h,--help output usage information

Using of artifacts

Both output.mp4 and output.gif are extracted in the same folder as where command is executed.

Installation

Install the dependencies and devDependencies and start the server.

npm install site-recorder -g
npm run example:gif # generates both gif and video

Development

Want to contribute? Great! Please take a look at opened issues. Related TeamCity: http://tc.dev.wixpress.com/viewType.html?buildTypeId=SiteRecorder_SiteRecorder_O

Using site recorder as Library

Exposed several function to allow using site recorder as library for services.

  • execute [Default module] - execute the site recorder on two urls
  • devices - return array of devices
  • networks - return array of networks
API
exexute (urls, options)
devices ()
networks ()
Name Description
urls Array of two urls that will be recorder
options resolution-width: [number]
resolution-height: [number]
device: [string] - valid value from devices
network: [string] - valid value from networks
timeout: [number] in millisecond
disable-colors: [boolean]
Installation
npm install site-recorder

License

MIT

site-recorder's People

Contributors

sidoruk-sv avatar vsashyn avatar erezpaperny avatar alexgoncharwix avatar lavieshai avatar itaibenda avatar github-sheriff avatar

Stargazers

 avatar Amit Dahan avatar Artem Yavorsky avatar Ran Yitzhaki avatar

Watchers

Luis Godinez avatar Ivan Kamenev avatar James Cloos avatar Jonathan Bensaid avatar  avatar Adam Matan avatar Danny Steinhoff avatar Mykyta Shyrin avatar Shai Ben-Yehuda avatar Omar Shibli avatar Algimantas Krasauskas avatar Guy Sopher avatar  avatar avgar marciano avatar Ariel avatar Ihor Krysenko avatar JJ Major avatar  avatar Roman Shevchuk avatar Matan Lieberman avatar Yuval Aviyam avatar Olesia Zaichenko avatar Maor Hamami avatar Gregory Bondar avatar Dror avatar Ward Abbass avatar uri bechar avatar Artur Rieznik avatar Ariel Wine avatar Ilya Lytvynov avatar Leonid Zhuk avatar Oren Zakay avatar Peter Tarasenko avatar Tomer Chajaj avatar Tetiana Stashchenko avatar Adam Shavit avatar Eyal Malron avatar ittay avatar Jonas Kabelka avatar Sergey Shpadyrev avatar Guy Benron avatar Nir Orman avatar Avi Mualem avatar Guy Segev avatar Alexey Soshin avatar Dmitriy Gordienko avatar  avatar  avatar Yakir Amar avatar Dom avatar  avatar Yonatan Hattav avatar Ihor Kucherenko avatar  avatar Cheli Bachar avatar Aleksandra Pervunina avatar Assaf Segev avatar  avatar Nancy avatar Nojus Adomaitis avatar  avatar Yevheniia Hlovatska avatar Miki Leib avatar

site-recorder's Issues

clean up temporary folders

At the moment we use temp folder to process trace data from puppeteer. Please clan folder once data is converted

Fix release & usage flow

npx site-recorder should install and run the CLI

Also:

  • Update the usage README accordingly (shouldn't be npm i and then site-recorder)
  • Add docs for all the CLI options

Add custom puppeteer script

Instead of just rendering the page here: https://github.com/wix-incubator/site-recorder/blob/master/src/puppeteer-trace-with-screeshots.js#L39

Support a custom script that does the navigation and possibly other actions (clicks, more navigations, etc).
This could possibly be implemented using another parameter with a script that exports a function like:

/*
page: puppeteer page object
*/
export default async function customNavigation(page, url) {
  await page.goto(url, {waitUntil: 'networkidle2'});
  await page.evaluate(() => window.getElementBy('#button').click());
  await page.waitForSelector('#second-view');
  ...
}

Cleanup console output

Make console out put more cohesive and expressive.
Separate logging for each task during conversion.

For instance
Stage: generating temporary folders...
Complete stage successfully
etc

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.