pc035860 / YCS-cont

Chrome Extension: YCS. Search for comments and authors in YouTube videos
MIT License
77 stars 6 forks source link

Credit cards/banks list in options file..why? #19

Closed thorn-cell closed 3 months ago

thorn-cell commented 3 months ago

In this file,

https://github.com/pc035860/YCS-cont/blob/main/options/options.a83916c6.js

There is a long list of various banks credit cards and companies, heres a small selection:

"alibaba","alipay","allfinanz","allstate","ally","alsace","alstom","am","amazon","americanexpress","americanfamily"

Why? (This is in the original YCS extension source code as well),

fugitivealien commented 3 months ago

Looks like some sort of keyword list? Not sure the function. It seems to include words from AARP and abudhabi to zero, and zuerich.

thorn-cell commented 3 months ago

Looks like some sort of keyword list? Not sure the function. It seems to include words from AARP and abudhabi to zero, and zuerich.

I am not sure of the function of most of what I am seeing in this file, its extremely obfuscated and this list of keywords is saturated with money related topics/companies/words. its an odd list, its not like its a list for general language processing, its a list targeted towards certain sectors of life.

oddlist

Edit: it looks to be a top level domain list, chatgpt gave me a bunch of reasons why something like this might exist in an extension.. the whole file still seems odd to me how its so large and obfuscated.. one can retrieve youtube comments without a TLD list.

fugitivealien commented 3 months ago

It seems as if other projects use these similar words in JSON files. They're related to TLD (Top Level Donains) on IANA/WHOIS. eg: https://github.com/mitchellkrogza/Stop.Google.Analytics.Ghost.Spam.HOWTO/blob/master/iana-domains-db.json

https://github.com/deweb-services/deweb/blob/main/genesis.json

thorn-cell commented 3 months ago

It seems as if other projects use these similar words in JSON files. They're related to TLD (Top Level Donains) on IANA/WHOIS. eg: https://github.com/mitchellkrogza/Stop.Google.Analytics.Ghost.Spam.HOWTO/blob/master/iana-domains-db.json

https://github.com/deweb-services/deweb/blob/main/genesis.json

i think i edited my comment seconds before you replied lol. but yea looks like a TLD list. i still have no clue whats going on in most of that massive options file, and i doubt anyone does except the guy who first wrote the extension. it seems like way more code than what is needed for what the extension does, thats for sure.

fugitivealien commented 3 months ago

Yeah, just saw that. ChatGPT vs Google to the rescue. Now we need someone that can figure out how, why, or if this JSON file is being referenced for an explanation that would be great. Mmmkay? lol

thorn-cell commented 3 months ago

Yeah, just saw that. ChatGPT vs Google to the rescue. Now we need someone that can figure out how, why, or if this JSON file is being referenced for an explanation that would be great. Mmmkay?

There is a ton of obfuscated/minified code in this extension that I am sure is totally benign and possibly part of a larger web application that was simply included in this during development, but even with the hardened security of browsers I still like to know what is going on in every piece of code I install, and seeing how this is from the original extension and the original extension wasn't open source, it makes me think. How did you see my issue report on this btw?

fugitivealien commented 3 months ago

I'm subscribed to all notices on the project, including issues & discussion. It's nice to see some movement on YCS continued. The extension has been great to look for questions, prevent spamming a duplicate comment, and continuing discussion from a specific comment I would have made myself. I'm also using a TamperMonkey script someone posted to the original project's issue topics that allows sorting by categories such as likes, dates, members, links, replies, etc.

thorn-cell commented 3 months ago

I'm subscribed to all notices on the project, including issues & discussion. It's nice to see some movement on YCS continued. I'm also using a TamperMonkey script someone posted to the original project's issue topics that allows sorting by categories such as likes, dates, members, links, replies, etc.

Are you referring to sonigys issue page? I just tried looking for the script you are referring to sounds interesting

fugitivealien commented 3 months ago

It was from a request I made back in Jan '23. Link to discussion with incremental improvements here: https://github.com/sonigy/YCS/discussions/42#discussioncomment-6681668 TLDR below for the TamperMonkey script by @knoajp & improved by @Letssharearow to sort by likes. Or it's a single click at Greasy Fork to install the script if you have TamperMonkey loaded. https://greasyfork.org/en/scripts/467013-youtube-ycs-sort-by-likes

// ==UserScript== // @name YouTube YCS Sort By Likes // @namespace juliSharowYouTubeYCSSortByLikes // @description This script is for the YCS Chrome add on. It creates a button next to the search button that will sort the resulting comments in order by likes // @version 1.0.3 fix 2.5 === 2,7 by using (parseFloat) and replace comma with dot // @match https://www.youtube.com/* // @run-at document-idle // @license MIT // ==/UserScript==

const debug = false;

(async function (_undefined) { if (debug) console.debug("YouTube YCS Sort By Likes"); const buttonId = "ycs_btn_sort_by_likes";

function getLikesFromTextContent(textContent) { if (debug) console.debug("textContent", textContent); const likes = parseFloat(textContent.replace(",", ".")); if (debug) console.debug("parseFloat(textContent).replace(',','.')", likes); if (textContent.toUpperCase().includes("K")) { if (debug) console.debug("textContent.toUpperCase().includes(K)"); return likes * 1000; } return likes; }

function sortResults() { const comments = Array.from( document.querySelectorAll(".ycs-icon-like + .ycs-like-count") ); if (debug) console.debug("comments", comments);

comments
  .sort((a, b) => {
    return (
      getLikesFromTextContent(a.textContent) -
      getLikesFromTextContent(b.textContent)
    );
  })
  .forEach((e) =>
    document
      .querySelector("#ycs_wrap_comments")
      .prepend(e.parentNode.parentNode.parentNode.parentNode.parentNode)
  );

}

async function getSortButton() { if (debug) console.debug("button doesn't exist already");

const searchButton = document.querySelector("#ycs_btn_search");
if (!searchButton) {
  if (debug) console.debug("searchButton doesn't exist", searchButton);
  return undefined;
}
const sortButton = searchButton.cloneNode(true);
sortButton.id = buttonId;
sortButton.textContent = "Sort by Likes";
searchButton.parentNode.insertBefore(sortButton, searchButton.nextSibling);
sortButton.addEventListener("click", (e) => {
  if (debug) console.debug("add OnClick to button", sortButton);
  sortResults();
});

return sortButton;

}

async function setSortButton() { if (document.querySelector(#${buttonId})) { if (debug) console.debug("button already exists in Doc", buttonId); return; } let sortButton; while (sortButton === undefined) { sortButton = getSortButton(); if (debug) console.debug("sortButton", sortButton); await new Promise((r) => setTimeout(r, 500)); } } setSortButton(); window.addEventListener("scroll", setSortButton); })();

thorn-cell commented 3 months ago

script

oh ok it was in discussions I see, thanks for linking it. As for sorting by like count, have you ever tried

https://addons.mozilla.org/en-US/firefox/addon/youtube-comment-reader/

it has sorting by likes as well. I think between all of the youtube comments extensions, YCS and youtube-comment-reader are the best, its nice that YCS is embedded in the page though. I have personally developed a script that does a word cloud and sentiment analysis on comments and embeds it in the page, but I have been looking through these extensions trying to familiarize myself with youtubes internal API so I can use that instead of data API.

fugitivealien commented 3 months ago

I haven't checked that one out, I like the loading bar for comments. It could be a YCSC feature request. lol

thorn-cell commented 3 months ago

I haven't checked that one out, I like the loading bar for comments. It could be a YCSC feature request. lol

off the top of my head its the only other extension that is properly utilizing a working interaction with the youtubei (internal) api other than the few YCS forks. its source code is pretty advanced as well..

Ive been trying to understand it the past few days, along with YCS cont, to better learn how to implement using the internal API into my wordcloud script which currently is reliant on my personal youtube data API key.

work_in_progress

fugitivealien commented 3 months ago

That datavis is pretty sweet. I'm rocking chrome though.

thorn-cell commented 3 months ago

I'm rocking chrome though.

https://chromewebstore.google.com/detail/youtube-comment-reader/jbjbjeceipecokoeocnkcfjpanlipamf?hl=en

fugitivealien commented 3 months ago

Thanks for the lazy save. Looking forward to catching video vibes.

fugitivealien commented 3 months ago

If you ever get around to redacting it, I'd love to see that wordcloud code. Let us know when you get it on the git.

thorn-cell commented 3 months ago

If you ever get around to redacting it, I'd love to see that wordcloud code. Let us know when you get it on the git.

OK sure.

pc035860 commented 3 months ago

I did little modifications on the options page, so the options.a83916c6.js is just left untouched. I'll take a look and come back to you.

pc035860 commented 3 months ago

The TLD list belongs to npm package https://www.npmjs.com/package/tlds, which is imported by https://www.npmjs.com/package/url-regex.

url-regex is used to identify links in YouTube comments in this extension, but somehow it got bundled into the options page script.

fugitivealien commented 3 months ago

Good catch. I know YCS has a sort by "Links" but I've never used it, Would be handy to identify useful vs spam URLs in comments.

Letssharearow commented 3 months ago

It was from a request I made back in Jan '23. Link to discussion with incremental improvements here: sonigy/YCS#42 (reply in thread) TLDR below for the TamperMonkey script by @knoajp & improved by @Letssharearow to sort by likes. Or it's a single click at Greasy Fork to install the script if you have TamperMonkey loaded. https://greasyfork.org/en/scripts/467013-youtube-ycs-sort-by-likes

yo, didnt see I was mentioned here. This thread is pretty chaotic: Banks / word clouds / sort by likes Is there anything I can help with?

fugitivealien commented 3 months ago

Yeah, sorry we diverged from the original topic of the TLD file being potentially SUSpect. @pc035860 might look at removing it. I was just singing your TamperMonkey script's praises.

thorn-cell commented 3 months ago

The TLD list belongs to npm package https://www.npmjs.com/package/tlds, which is imported by https://www.npmjs.com/package/url-regex.

url-regex is used to identify links in YouTube comments in this extension, but somehow it got bundled into the options page script.

Hey thanks for the answer, I am a bit of a novice in terms of extension development and I saw this while I was poking around the source code trying to find and understand all of the parts that interacted with the youtube internal API in getting the comments.

Seeing as this TLDs list appears to be benign I suppose this topic is resolved thanks.