8BitRam.dev
Home
Portfolio
Feed
In-Dev
Future Projects
About Page

About LazYT

LazYT is a python script that runs inside your browser utilizing PyScript (more info @ pyscript.net). Its purpose is to analyze the watch history of a YouTube user and provide statistics. The Pre-Alpha does this by utilizing a Google Takeout order to provide YouTube watch history in JSON format, that's then uploaded to the tool.

These stats are broken up into categories based on the header in [watch-history.json], splitting "YouTube" & "YouTube Music" to be analyzed separately. The entire dataset is also analyzed to create a third category with both YT and YT-Music combined. The datasets are copied and modified to their needs, like adding days with no entries or remove entries (such as videos removed by YT or Music visit logs). One of these sets are tallied by day and graphed, pitting Day vs # of Views. Another portion of sets are created to sort by entries with most replays, and output a select amount of top entries.

After outputing its analysis, you can modify how much of the dataset you would like to view by month or date range. You can also select which dataset you'd like to view and choose the size of your top lists.

For the future iterations of the tool, I plan on adding in the top watched channel breakdowns, which will share many similarities to the most replays breakdown. The next major feature will be estimating watch time, which requires integration with the Google API to request the runtime for the videos. After completing watch time estimations, I will work on adding a Google OAuth 2.0 Sign-In page to source the data from Google directly, forgoing the need for a Google Takeout order. I also would like to implement methods of sorting the videos using metadata, like tags, requested alongside watch time.

A Quick Note on PyScript:

Unlike many other web applications that use PHP, using PyScript avoids the need to run anything server side. Load your YT data directly into the page, which is stored in the PyScript also loaded into your browser. Then when you are done overlooking your analysis, you clear the data by closing the page. This of course, does not prevent the Python script itself from potentially offloading your data to a server. In addition, PyScript's can loaded from a source file, instead of embedding python functions into the HTML. This script file will not be available in the sources tab of the developer console, meaning you will be unable to see what the python file itself is running. Despite these possible issues, the benefit of avoiding the server entirely and keeping the data local to your browser seemed like the perfect usecase for an online version of this tool.

One final remark, PyScript is still in alpha itself and is not recommended for production at the moment. Since this tool works on data that contains no actual identifying information on the account itself, I feel comfortable posting the tool and allowing others to also get a deeper insight into their watch history. For more information on how PyScript runs and how it compares to PHP, you can checkout PyScript's FAQ.


Last Modified on 11/21/22