Skip to content

Instantly share code, notes, and snippets.

@alimbada
Last active April 8, 2025 12:22
Show Gist options
  • Select an option

  • Save alimbada/4b9b3778d92f260cf289f1b2aa942aa8 to your computer and use it in GitHub Desktop.

Select an option

Save alimbada/4b9b3778d92f260cf289f1b2aa942aa8 to your computer and use it in GitHub Desktop.

Revisions

  1. alimbada revised this gist Apr 8, 2025. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -8,4 +8,4 @@ You will also need to install [xsv]([url](https://github.com/BurntSushi/xsv)) or

    Adjust the grep and awk expressions as appropriate. The grep expression will exclude lines where those strings are found (e.g. exclude teasers/trailers). The awk expression is necessary for specifying a cutoff for the show title to allow grouping of shows, e.g. `Stranger Things: Stranger Things 2: Chapter One: MADMAX (Episode 1)` will be transformed to `Stranger Things` to allow accurate counting of each shows views.

    ℹ️ Hint: If you want to see the number of unique titles viewed rather than the number of times a show/title was viewed, replace the first `sort` with `sort -u`
    ℹ️ Hint: If you want to see the number of unique titles viewed rather than the number of times a show/title was viewed, replace the first `sort` with `sort -u`. The default behaviour can be useful for analysing viewing habits of profiles where titles are viewed multiple times (e.g. children's profiles) but this may not be useful for many others. The default behaviour is also inaccurate as Netflix counts even viewing something for as little as 1 second as a view.
  2. alimbada revised this gist Apr 8, 2025. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    This script allows you to analyse the `ViewingActivity.csv` file included in your Netflix data and outputs a list of shows watched by a particular user ordered by frequency (i.e. number of times viewed and number of episodes viewed).
    This script allows you to analyse the `ViewingActivity.csv` file included in your Netflix data and outputs a list of shows watched by a particular profile ordered by frequency (i.e. number of times viewed and number of episodes viewed).

    #### Usage

  3. alimbada created this gist Apr 8, 2025.
    11 changes: 11 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    This script allows you to analyse the `ViewingActivity.csv` file included in your Netflix data and outputs a list of shows watched by a particular user ordered by frequency (i.e. number of times viewed and number of episodes viewed).

    #### Usage

    You will first need to request your Netflix data, download it and extract the zip file. You can do this by going to `Account -> Security -> Personal information access`

    You will also need to install [xsv]([url](https://github.com/BurntSushi/xsv)) or a similar tool.

    Adjust the grep and awk expressions as appropriate. The grep expression will exclude lines where those strings are found (e.g. exclude teasers/trailers). The awk expression is necessary for specifying a cutoff for the show title to allow grouping of shows, e.g. `Stranger Things: Stranger Things 2: Chapter One: MADMAX (Episode 1)` will be transformed to `Stranger Things` to allow accurate counting of each shows views.

    ℹ️ Hint: If you want to see the number of unique titles viewed rather than the number of times a show/title was viewed, replace the first `sort` with `sort -u`
    1 change: 1 addition & 0 deletions nflx-activity-analyser.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    grep PROFILE_NAME CONTENT_INTERACTION/ViewingActivity.csv | grep -Eiv "Trailer|Teaser|Clip" | xsv select 5 | tr -d '"' | sort | awk -F': Season|: Book|: Part|: Volume|: Limited|: Series|: Stranger' '{ print $1 }' | uniq -c | sort -nr