Comparing two arrays doesn't return 0
change ChecknapprovedAnimes.push(a.match(/\d+/));
to ChecknapprovedAnimes.push(a.match(/\d+/)[0]);
or use
if(a.match(/anime.*?(\d+)/) !== null) //If the saved value is an anime id
{ //Starts the if condition
ChecknapprovedAnimes.push(RegExp.$1); //Add the stored anime id to an array
} //Finishes the if condition
the string.match return a custom Array, which is an object that unique to each and always return false if you compare to others, that's why the filter not work. the match result contains not only the match strings but also the match group, which can be access by result[1]/result[2]
or RegExp.$1/RegExp.$2
, etc. that's why you need to use [0][0]
to reach the result id
@indefined
Thank you, I was already able to solve that.
The problem was what you mentioned here
I've already tried changing ChecknapprovedAnimes.push(a.match(/\d+/));
to ChecknapprovedAnimes.push(a.match(/\d+/)[0]);
But that wasn't working because my if condition was also wrong...
if (FinalApprovedAnimesArray.length === 0 || FinalApprovedMangasArray.length === 0)
But it should be this
if (FinalApprovedAnimesArray.length !== 0 || FinalApprovedMangasArray.length !== 0)
Now the only issue I've found is how to make it run every 3 hours, but I'm trying to work on that and see if I can find how to do it properly https://gf.zukizuki.org/en/scripts/428614-approved-entries-notifier-mal
I think that
ChecknapprovedAnimes[0]
should return the stored ID number, notChecknapprovedAnimes[0][0]
, not sure what I did wrongIt's interesting because when I run this on the browser console it works, but doesn't work on the script...
I will write below the parts of the script that probably has the problem in it somewhere
Full Script below