Netflix watched videos "DB" - viable?

People,

I can export my Netflix watched videos from their site to a CSV file and massage it so it has this format:

Title: Archer: Season 1: Pilot: Mole Hunt (Episode 1) {{{1
Date: 2016-12-28
Time: 08:23:13
Duration: 00:21:34

Title: Archer: Season 1: Training Day (Episode 2) {{{1
Date: 2016-12-28
Time: 08:45:00
Duration: 00:21:21

etc

This is so I can conveniently work with the file using Vim and Voom which allows me to do everything I want to do - but I need a way of displaying the records in a little web site so friends and relatives can look at the info too.

So I am thinking it could work like this:

  1. I recreate the file periodically as normal after watching a batch of movies

  2. I use a Jekyll app to import the file so it can be displayed as one long table on the app’s home page.

  3. I have the title for each record linked to a post in _posts/ in the normal way to display the plot and my notes.

This might seem a bit clunkey but I don’t want to have to use SQLite etc in a Rails app . .

What do you think?

Hmm . . now that I think about it a bit more - maybe the home page shoud have a list of years that are links to shorter tables . . and maybe I should just keep single line record CSV file with ‘|’ field separators . .

You can take the csv and put it into the /_data folder (or create it in the root folder).

After that, you can create a page (or pages) that display the information. Jekyll supports CVS, xml, json, yaml and other formats.

Here is a quick video that shows how to do it:

Working with Jekyll Data, Part 3: Custom Data

1 Like

If you can get the data into CSV, JSON, or YAML format, you can put it in _data directory as covered above

Then iterate over the data with Jekyll.

I wrote a tutorial on the docs on turning data in a CSV into a table.

For storage, you could manually dump the data from Netflix and then commit and push it.

Or you can have that automated to run say daily or weekly with GH Actions. That can either commit a file in the repo. or can build the site and update the data file without committing it but using it in the build.

I have a Jekyll project which runs daily to get data from GH API via a plugin i made and then builds the site using data on site object. So each repo becomes a “card” on the page but this could easily be a table.

I am thinking of rebuilding this site to use a separate step of outputting JSON file and then reading it with Jekyll, to make it easier to debug and also then my plugin in Ruby can be replaced with a Python script which I’d prefer.

Also considering moving away from MoustacheJS for the form input filtering and use Vue instead.


If you are into Vue or React, you could easily set up a one page site that pulls in data from a JSON file that you commit.

It makes templating easy - you pass in your data from a JSON path or a JS object and with a loop it gets turned into HTML, much like Jekyll but not static.

Especially good if you want to do any interactivity like sorting or filtering based a form input.

I have an site here using data from GH API as a one page Vue site with no build step. Served with GH Pages.

https://michaelcurrin.github.io/gist-viewer/

You could replace the call to GH API with a request to /assets/shows.json. I do that here in a plain HTML site with CSV data

And that JSON file can be the one you generated from Netflix data. Manually or with a scheduled task that commits the updates to the repo and rebuilds.

One other thing. Netflix doesn’t have a public API anymore but I found another site which uses Netflix and other providers as data.

I have a basic site that requests data from the API using Netlify Function and renders JSON results on the page including images.

Thus uses mustache for templating. If you don’t know Vue or React, mustache might be easier for you to get into to just make a table or list using a JS template. The mustache docs will help you there.

Bill, Michael.

Thanks for all that stuff! - I am looking at it all now - I think it should work!

1 Like

People,

OK, I have something working that is quite nice I think - I now have 6 years of viewing (2016-2021) in 6 different CVS files that produce 6 different tables.

The next step is to do some scripting that will help minimise manual creation of posts. From my previous little txt file and then Rails exercises, I have records that I could process into posts - all good! However, it would be really nice if a row in a table happens to have a corresponding post associated with that video, that when the CVS files are being processed, a link could be added to the title field.

So, currently my table production code looks like this:

---
layout: default
---

<table>
  {% for row in site.data.y2021 %}
    {% if forloop.first %}
    <tr>
      {% for pair in row %}
        <th>{{ pair[0] }}</th>
      {% endfor %}
    </tr>
    {% endif %}

    {% tablerow pair in row %}
      {{ pair[1] }}
    {% endtablerow %}
  {% endfor %}
</table>

I presume it is going to be possible to add an “if” statement to check if an appropriate post exists for that video, and, if it does, add the correct ink to the title field when the table is being created?

Thanks again - love Jekyll !

Phil.

1 Like

Cool. Yes, you can nest an if statement in there no problem.

2 Likes

People,

Is there some way of using pipe separated values instead of commas in the _data files? eg

Year | Name | Age
1952 | Phil | 70
1955 | Alan | 66

- I couldn’t get it to work . .

Thanks,
Phil.

1 Like

You cannot no. However if you can use tab-separated, Jekyll supports that. Ideally you put it in YAML or JSON format, but comma and tab separated are supported

2 Likes

Thought that might be the case - thanks for the confirmation!

1 Like

Hmm - they both work fine on my local machine but on GitLab only CSV works - I guess I should I tell someone there is a problem . .

1 Like

That’s very odd. Does gitlab allow you to do a custom build ala GitHub Actions? That could resolve the problem.

1 Like

I don’t know what that is - I will check it out . .

Thanks.