chrome.runtime.sendMessage({action: "getUnogsToken"}, function(response) {
  unogsToken = null;
  if (response.result) {
    unogsToken = response.result.token;
  }

  var filmography_section = $(".filmo-category-section")
  filmography_section.children().each(function (index) {
    var year_elem = $(this).children("span");
    var year = year_elem.text();
    var film_elem = $(this).children("b").children("a");
    var title = film_elem.text();
    var url = film_elem.attr('href');

    getRating(title, url, year, year_elem);
  });
});

function getRating(title, url, year, element) {
  var useOmdb = true;

  if (useOmdb) {
    getRatingOmdb(title, year, element);
  } else {
    getRatingImdb(url, year, element);
  }
  // getNetflixCountries(title, element)
}

/*
 * Get the IMDb page via the url parameter and parse the rating.
 * Append the rating to the year row in the current page.
 */
function getRatingImdb(url, year, element) {
  var xhr = new XMLHttpRequest();
  xhr.onreadystatechange = function() {
    if (xhr.readyState === XMLHttpRequest.DONE && xhr.status === 200) {
      var data = $.parseHTML(xhr.responseText);
      var rating = null;
      $.each(data, function(index) {
        var value_elem = $(this).find("div.ratingValue");
        if (value_elem.length > 0) {
          var value = value_elem.children("strong").children("span").text();
          if (value != null) {
            rating = value;
          }
        }
      });

      if (rating != null) {
        element.text(rating + '\xa0' + year);
      }
    }
  };

  xhr.open('GET',"https://www.imdb.com" + url, true);
  xhr.send();
}

/*
 * Get film rating using the OMDb API.
 * Append the rating to the year row in the current page.
 * Note: the OMDb API was made private on May 9, 2017, and then subsequently was made public again on November 2, 2017.
 */
function getRatingOmdb(title, year, element) {
  var api_key = 'ab272ca2'
  var rating = null;

  var title_re = new RegExp(' ', 'g');
  enc_title = title.replace(title_re, "+");

  var year_re = new RegExp(/\d\d\d\d/);
  year = year_re.exec(year);
  if (year != null) {
    year = year[0];
  } else {
    year = "";
  }

  var xhr = new XMLHttpRequest();
  var base_url = 'https://www.omdbapi.com/'
  var title_query_param = '?t=' + enc_title
  var year_query_param = '&y=' + year
  var format_query_param = '&plot=short&r=json'
  var api_key_param = '&apikey=' + api_key
  var endpoint = base_url + title_query_param + year_query_param + format_query_param + api_key_param

  xhr.onreadystatechange = function() {
    if (xhr.readyState === XMLHttpRequest.DONE && xhr.status === 200) {
      var data = JSON.parse(xhr.responseText);
      rating = data.imdbRating;

      if (rating != undefined) {
        element.html('<b>' + rating + '</b>\xa0' + year);
      }
    }
  };
  xhr.open('GET', endpoint, true);
  xhr.send();
}

function getNetflixCountries(title, element) {}

@@ -172,26 +172,25 @@
  filmography
-_s
+S
 ection = $(%22
@@ -232,10 +232,9 @@
 aphy
-_s
+S
 ecti
@@ -283,21 +283,23 @@
 var year
-_e
+E
 lem
+ent
  = $(thi
@@ -338,21 +338,23 @@
 r = year
-_e
+E
 lem
+ent
 .text();
@@ -366,21 +366,23 @@
 var film
-_e
+E
 lem
+ent
  = $(thi
@@ -433,21 +433,23 @@
 e = film
-_e
+E
 lem
+ent
 .text();
@@ -467,21 +467,23 @@
 l = film
-_e
+E
 lem
+ent
 .attr('h
@@ -526,21 +526,79 @@
 ar, year
-_elem
+Element);%0A    getNetflixCountries(title, url, year, yearElement
 );%0A  %7D);
@@ -1273,26 +1273,34 @@
     var 
-v
+ratingV
 alue
-_e
+E
 lem
+ent
  = $(thi
@@ -1339,26 +1339,34 @@
     if (
-v
+ratingV
 alue
-_e
+E
 lem
+ent
 .length 
@@ -1398,18 +1398,26 @@
 e = 
-v
+ratingV
 alue
-_e
+E
 lem
+ent
 .chi
@@ -1991,21 +1991,24 @@
 %7B%0A  var 
-api_k
+omdbApiK
 ey = 'ab
@@ -2048,19 +2048,21 @@
 ar title
-_re
+Regex
  = new R
@@ -2079,26 +2079,29 @@
  'g');%0A  enc
-_t
+odedT
 itle = title
@@ -2114,19 +2114,21 @@
 ce(title
-_re
+Regex
 , %22+%22);%0A
@@ -2138,19 +2138,21 @@
 var year
-_re
+Regex
  = new R
@@ -2187,11 +2187,13 @@
 year
-_re
+Regex
 .exe
@@ -2318,18 +2318,17 @@
 var base
-_u
+U
 rl = 'ht
@@ -2358,32 +2358,30 @@
 %0A  var title
-_q
+Q
 uery
-_p
+P
 aram = '?t='
@@ -2390,10 +2390,13 @@
  enc
-_t
+odedT
 itle
@@ -2402,32 +2402,30 @@
 e%0A  var year
-_q
+Q
 uery
-_p
+P
 aram = '&y='
@@ -2440,32 +2440,30 @@
   var format
-_q
+Q
 uery
-_p
+P
 aram = '&plo
@@ -2484,25 +2484,27 @@
 '%0A  var 
-api_key_p
+omdbApiKeyP
 aram = '
@@ -2515,21 +2515,24 @@
 key=' + 
-api_k
+omdbApiK
 ey%0A  var
@@ -2551,10 +2551,9 @@
 base
-_u
+U
 rl +
@@ -2558,24 +2558,22 @@
  + title
-_q
+Q
 uery
-_p
+P
 aram + y
@@ -2575,24 +2575,22 @@
 m + year
-_q
+Q
 uery
-_p
+P
 aram + f
@@ -2598,32 +2598,32 @@
 rmat
-_q
+Q
 uery
-_p
+P
 aram + 
-api_key_p
+omdbApiKeyP
 aram

Transform snake_case to camelCase