Created
February 14, 2015 12:14
-
-
Save hugoboos/68b830aec8e7cab65055 to your computer and use it in GitHub Desktop.
Remove history from Trakt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Run in console on the history page (http://trakt.tv/users/<username>/history) | |
// Will remove all the items, on that page, from the watched history. | |
$(".posters .grid-item").each(function(){ | |
var $this = $(this); | |
historyRemove($this, $this.data("history-id")); | |
}) |
Still working in 2023, thank you so much!
Yes, need to remove quite a few duplicate watches on the same day and this will be a time saver. Thanks so much!
This helps avoiding the API limit getting hit by making a API request every 500ms.
const gridItem = $(".posters .grid-item");
let index = 0;
const interval = setInterval(function(){
if(index === gridItem.length){
clearInterval(interval)
return;
}
const $this = $(gridItem[index]);
historyRemove($this, $this.data("history-id"));
index++;
},500);
Tampermonkey version with all pages
https://gist.github.com/oc013/f0e2c2c3034c972abbc772790f69985e
// ==UserScript==
// @name Trakt History Remover
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Clear all trakt history
// @author You
// @match https://trakt.tv/users/*/history
// @grant none
// ==/UserScript==
function waitForJQuery() {
if (typeof unsafeWindow.jQuery !== "undefined") {
main();
} else {
setTimeout(waitForJQuery, 100);
}
}
function main() {
let $ = unsafeWindow.jQuery;
const gridItem = $(".posters .grid-item");
let index = 0;
const interval = setInterval(function () {
if (index === gridItem.length) {
clearInterval(interval);
window.location.reload(); // refresh the page
return;
}
const $this = $(gridItem[index]);
unsafeWindow.historyRemove($this, $this.data("history-id"));
index++;
}, 1500);
}
(function () {
"use strict";
waitForJQuery();
})();
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This does it on a loop every 10s, useful if you have multiple pages:
It can be improved if you add a variable so it breaks once it goes over the amount of pages you actually have but I was too lazy to do that :)