Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[issue-2164] added '--tag' flag functionality #2169

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

roxerj
Copy link

@roxerj roxerj commented Jun 12, 2024

Created --tag flag which allows to search for usernames with a tag.

Example usage: sherlock sophie#1911 --tag

Tested for all exceptions and errors I could think of.

The way it works now is if you enter sherlock sophie --tag an error is thrown that tells user to add a tag if the tag flag is used.
In a successful search, websites are filtered using a new property isTagRequired, and only websites that have it set to True will remain in the list (isTagRequired is False by default).

If the flag --site is used with a website that has isTagRequired set to True but --tag flag wasn't set, a specific error is thrown.
If the flag '--site' is used with a website that has isTagRequired set to False but --tag flag was used, another specific error is thrown.

Also searching for multiple usernames works, e.g. sherlock sophie#1911 roxerj --tag would return the websites found for the first username, and print an error for a username without a tag.
sherlock sophie#1911 "normalus bahuras#euw" --tag works correctly.

Please let me know if you would like me to change the logic in any way.
A viable option would be to dynamically determine whether usernames have tags or not, and based on that, return results, with this option --tag flag would be unnecessary.

…rnames with tags, for example "username#tag".
juozapas.cypas added 3 commits June 12, 2024 18:04
@roxerj
Copy link
Author

roxerj commented Jun 12, 2024

TESTS

sophie#1911 returns result correctly,

sophie is missing a tag,

sophie#test does not exist on any website

image

--tag flag is set, but chosen website with --site doesn't contain tags in usernames

image

a website that requires a tag in username is chosen with --site, but --tag was not set

image

@ppfeister
Copy link
Member

I get the feeling that these sites would be better served by a regexCheck value that requires a discriminator, rather than a dedicated flag for it

As an example... ^\w+?#\d{4}$ for any alnum chars or underscores followed by a four digit discriminator. This would also mean that these sites are probed any time that condition is met (automatically) and never when it's not, rather than requiring an additional step. This is similar to other site-specific patterns that have been added.

Thoughts?

@Gregory-rt
Copy link

Makes sense to me to not require a dedicated flag. Only issue I see is that not all tags are necessarily 4 alnum chars, so am not sure what the regexCheck should be.
Examples
https://www.leagueofgraphs.com/summoner/br/frosty-KR3 here the tag is "KR3"
https://www.leagueofgraphs.com/summoner/eune/Manios13-fusen here the tag is "fusen"

@ppfeister
Copy link
Member

ppfeister commented Jun 12, 2024

The expression is site specific, so it can be anything

I don't know the first thing about league but if I understand their requirements correctly...
^[a-zA-Z0-9]{3,16}#[a-zA-Z0-9]{3,5}$ should work.

The only issue would be figuring how to translate this at runtime into the url format you provided (with a - in place of #) or finding an alternative probe url with # (presumably url encoded as %23)


Edit: regex assumes that usernames use #, because that's just what I read. But if they use - as in the url then no translation is required and the regex can be changed to match

@ppfeister
Copy link
Member

Possible solution to the translation issue would be to leverage match groups and then populate the url by group. This wouldn't allow for dynamic translations, but it would allow for consistent ones such as #->-.

@ppfeister
Copy link
Member

@Gregory-rt @roxerj Do either of you know of any sites that use discriminators where the url does something other than swap the # for a -?

@Gregory-rt
Copy link

The only one I can find is https://tracker.gg/

This site supports multiple games and it handles the # by replacing it with a %23

Examples
Valorant -> https://tracker.gg/valorant/profile/riot/heat%23carol/overview ---- Username: heat #: carol
LeagueOfLegends -> https://tracker.gg/lol/profile/riot/EUNE/NotPurple%23EUNE/overview? ---- Username: NotPurple #: EUNE

Since we are already supporting League though with the other site (which imo is better), it is not that important. I have not found a better alternative for Valorant yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants