IMDb Page Cleaner

Remove unnecessary information from IMDb & rearrange the layout

Author
scoobydooooo
Daily installs
0
Total installs
104
Ratings
0 0 0
Version
1.0.1
Created
2022-04-30
Updated
2022-10-04
Size
3.52 KB
License
GNU GPLv3
Applies to

IMDb Page Cleaner

This is a Greasemonkey script to clean IMDb movie & tv pages and to modify layout. I wrote this to satisfy my needs but it can easily be modified to suit yours as well.

GitHub: https://github.com/dvnlgls/GM-IMDb-Page-Cleaner

Screenshot of before & after running the script: https://github.com/dvnlgls/GM-IMDb-Page-Cleaner/raw/master/Screenshots/03_Comparison.jpg

Version: 1.0.1

What this script does:

  • Removes a lot of extraneous information from the page. Examples: popularity rating in the header, news, contribution, the whole right pane with useless stuff, etc.
  • Moves user review section just below the header. Also expands the section so you can see the full review. (see function modifyLayout to change this behavior)
  • Moves photos & videos just below the cast.

What else can this script do?

  • The code is simple & easy to edit. You can add/remove any sections you want. Make sure you choose the right selector.
    • Protip: A HTML node collection may look like an array but it's technically not an array. So convert to array if you intend to do array operations.
  • It's also easy to modify the sections as you please. Look for the data-testid attribute on the page, as they tend to be unique & don't have obfuscated names.

Optional Customization snippets:

I'll list some useful code that you might find interesting.

1. Showing all languages under main title (last tested: 2023-06-03)

function addLanguageMetadata() {
  const languages = [...document.querySelectorAll("[data-testid='title-details-languages'] a")];
  const titleParent = document.querySelector("[data-testid='hero__pageTitle']").parentNode; 
  const titleMetadata = titleParent.getElementsByTagName('ul')[0] ;

  if (languages && titleMetadata) {
      languages.forEach(language => {
          const languageElement = document.createElement("li");
          languageElement.textContent = language.textContent;
          languageElement.setAttribute("role", "presentation");
          languageElement.classList.add("ipc-inline-list__item");
          titleMetadata.appendChild(languageElement);
      });
  }
}

Preview: https://user-images.githubusercontent.com/19514284/242252575-34c67912-bedb-4323-80e0-f06963fcaf58.png

2. Showing all reviews in the main title page in a scrollable section (last tested: 2023-06-01)

  • Author: This script's developer

Code:

function loadAllReviews() {
  const userReviews = document.querySelectorAll("[data-testid='UserReviews']")[0];
  const currentUrl = userReviews.getElementsByClassName('ipc-title-link-wrapper')[0];
  const modifiedUrl = currentUrl.href.split('reviews?')[0] + 'reviews?sort=reviewVolume&dir=desc&ratingFilter=0';

  document.querySelectorAll("[data-testid='reviews-author']")[0].remove();

  fetch(modifiedUrl)
    .then((response) => {
      return response.text();
    }).then((html) => {
      const parsedDoc = new DOMParser();
      const doc = parsedDoc.parseFromString(html, "text/html");
      return doc;
    })
    .then((doc) => {
      const newReviews = doc.getElementsByClassName('lister-list')[0].innerHTML;
      userReviews.getElementsByClassName('ipc-list-card--base')[0].innerHTML = newReviews;
      cleanReviewFooter();
    })
    .then((doc) => {
      cleanReviewFooter();
    });
}

function cleanReviewFooter() {
  const reviews = document.getElementsByClassName('lister-item-content');

  if (reviews.length > 0) {
    const reviewArr = [...reviews];

    reviewArr.forEach(e => {
      let footer = e.getElementsByClassName('text-muted')[0];
      footer.innerText = footer.innerText.replace('|', '');
    })
  }
}

# Don't forget to call loadAllReviews()

If you have some cool snippet to share, please drop a message in the feedback section.

Change Log:

Version 1.0.1 (2022-05-01)

  • New: Remove watch options in "More Like This" section (suggestions)