Greasy Fork is available in English.

Diskussionen » Greasy Fork Rückmeldungen

Improve match/include rules detection that uses regex

§
Veröffentlicht: 23.11.2020

Isn't that hard to find that a lot of match and include rules are not correctly "displayed" by greasyfork. They are not translated into the websites, so the scripts are not easy to find.

wOxxOmMod
§
Veröffentlicht: 23.11.2020

Might be possible by using a regexp parser to build an array of possibilities and analyze it. Probably not trivial though.

§
Veröffentlicht: 23.11.2020

This shouldn't be something hard to implement, I also don't think it's trivial. If it was trivial greasyfork wouldn't already have this feature, and also wouldn't have a filter to filter/search for scripts by the site that are on the script match/include rules.

I mean why is this regex /^https:\/\/myanimelist\.net\/anime\/[\d]+(\/.*)?/ understood by greasyfork that the script works on myanimelist.net
while this regex /^https:\/\/myanimelist\.net\/anime\/[0-9]+\/* is not displayed as being a script made for myanimelist.net?
These 2 regexs aren't that much different anyways,this seems to be a greasyfork bug

§
Veröffentlicht: 23.11.2020

It's probably just a lack of imagination on my part. As you note, some cases are handled. If you can come up with a list then I can look into it. Or better yet you can try coding it yourself.

https://github.com/JasonBarnabe/greasyfork/blob/master/lib/js_parser.rb#L106
https://github.com/JasonBarnabe/greasyfork/blob/master/test/lib/js_parser_applies_to_test.rb

§
Veröffentlicht: 23.11.2020

Thanks. I don't have an account on github, for now I would like not to have one...
I will think if I will do this list or not on my spare time.

§
Veröffentlicht: 24.11.2020

/^https:\/\/myanimelist\.net\/anime\/[0-9]+\/*

This is not considered a regex as it doesn't end with a slash. With it not being a regex, it's considered a glob, and so it doesn't see that as a valid URL due to the special characters everywhere.

§
Veröffentlicht: 24.11.2020

Thanks. This makes sense.
But I'm not sure if the other scripts I see also have this same problem, or if is something different

§
Veröffentlicht: 24.11.2020

Well like I said, if you see examples, let me know. I can fix and add it to the test suite. The current code is definitely not handling everything.

§
Veröffentlicht: 24.11.2020

sure,I will think if I will do this list or not on my spare time.I want to help, and I will if I can

§
Veröffentlicht: 16.03.2021

@JasonBarnabe
/(https?:\/\/)+(gumroad|laostelephone)(\.com)(\/.*)?/

The regex is perfect I guess, but greasyfork doesn't accept them as being different websites and just shows the whole regex. How can I make greasyfork recognize every url on that regex?

https://gumroad.com/adasdasdasd
https://laostelephone.com/wwww2

§
Veröffentlicht: 16.03.2021

@hacker09

// @match           gumroad.com
// @match           laostelephone.com
// @include         /(https?:\/\/)+(gumroad|laostelephone)(\.com)(\/.*)?/
§
Veröffentlicht: 16.03.2021
Bearbeitet: 16.03.2021

@Konf

The include regex already matches the matches... so there's no need to have them there...
That's why I want to use regex and include instead of a bunch of match rules...

§
Veröffentlicht: 16.03.2021

a bunch of match rules

Is there a lot? It works though

§
Veröffentlicht: 16.03.2021

@Konf

I've a script with more than +/- 52 match rules...

§
Veröffentlicht: 19.03.2021

Regex parsing is never going to be perfect, but that format should be doable. Filed https://github.com/JasonBarnabe/greasyfork/issues/877 for

§
Veröffentlicht: 19.03.2021

@JasonBarnabe

Thank you so much. I would also like to suggest that greasyfork should have a page explaining somewhere how the regexes matching works on greasyfork, so that devs can correctly do the regex in a way that greasyfork will understand.

Also please let me know when this new "or regex" implementation is done so I can add this to my scripts.

§
Veröffentlicht: 28.03.2021

I've reworked how regexps are handled so it should be much better (though still not perfect) now. Let me know if you are still seeing issues.

§
Veröffentlicht: 30.03.2021
Bearbeitet: 30.03.2021

@JasonBarnabe
Nice, it's much better now!

Thanks for remembering to let me know when you finished doing that!

Btw
These doesn't work well
// @match /(https?:\/\/)(www\.)?+(thepiratefilmes?torrent)(\.tv)(\/.*)?/
// @match /(https?:\/\/)(www\.)?+(adrenalinagames.com|mastercuriosidadesbr.net)(\/.*)?/
// @match /(https://adrenalinagames.com|https://mastercuriosidadesbr.net)(\/.*)?/
// @match *://filmestvdublado.home.blog/*
// @match *://filmeshdcompletos1.podbean.com/*

§
Veröffentlicht: 31.03.2021

/(https?:\/\/)(www\.)?+(thepiratefilmes?torrent)(\.tv)(\/.*)?/

Looks like it would match thepiratefilmetorrent.tv. Is that not what's happening?

/(https?:\/\/)(www\.)?+(adrenalinagames.com|mastercuriosidadesbr.net)(\/.*)?/

/(https://adrenalinagames.com|https://mastercuriosidadesbr.net)(\/.*)?/

The lack of escaping for the .s makes these not work.

*://filmestvdublado.home.blog/*

*://filmeshdcompletos1.podbean.com/*

These are not regular expressions, but I'm not seeing a problem. They become home.blog and podbean.com.

§
Veröffentlicht: 31.03.2021
Bearbeitet: 31.03.2021
Looks like it would match thepiratefilmetorrent.tv. Is that not what's happening?

No. It's supposed to match thepiratefilmetorrent.tv and thepiratefilmestorrent.tv

The lack of escaping for the .s makes these not work.

How could I make them work then?

Yes they aren't, but they should become
filmestvdublado.home.blog
filmeshdcompletos1.podbean.com

§
Veröffentlicht: 31.03.2021

No. It's supposed to match thepiratefilmetorrent.tv and thepiratefilmestorrent.tv

The way the regex reverser works is that if it sees a quantifier, it will use the minimum repetitions allowed. If you want it to pick up on domains, I'd recommend using an alternation (|). Or just use normal domain rules because it looks like that's what you're trying to match.

Yes they aren't, but they should become
filmestvdublado.home.blog
filmeshdcompletos1.podbean.com

It does TLD+1.

§
Veröffentlicht: 31.03.2021
Bearbeitet: 31.03.2021

This
/(https?:\/\/)(www\.)?+(thepiratefilmes?torrent)(\.tv)(\/.*)?/
is a shortcurt for
/(https?:\/\/)(www\.)?+(thepiratefilmestorrent|thepiratefilmetorrent)(\.tv)(\/.*)?/

So I shared that shortcut that isn't recognized as 2 websites now by greasyfork just because I tried to use them but they weren't recognized, but if you don't want to add support for that, that's okay too...

https://i2.paste.pics/39d67786e967657c2abf9c7a92cbfcfa.png

No, they both become just home.blog and podbean.com

§
Veröffentlicht: 31.03.2021

I don't know what you're saying.

It would also be useful if you linked to the script in question.

§
Veröffentlicht: 02.04.2021

Wait.. Maybe it was not a bug. I just forgot to escape a dot character

§
Veröffentlicht: 02.04.2021

When reverse regexp sees an unescaped ., it replaces it with a. Why a? Why not? It's as good of a guess as any other character.

§
Veröffentlicht: 02.04.2021

Asterisk might be better

§
Veröffentlicht: 02.04.2021

Well then it would see the URL as http://www.google*com, see that that's not a valid URL, and fail anyway.

You just need to escape that period. Greasy Fork could be more useful by complaining about stuff it doesn't understand.

§
Veröffentlicht: 02.04.2021

You just need to escape that period

Sure thing. But overall, asterisk it is like a standart

complaining about stuff it doesn't understand

What you mean?

§
Veröffentlicht: 03.04.2021
Bearbeitet: 03.04.2021

The point of it is to turn a regex into a domain so the script can be classified. Making a regex . into an asterisk is not a step in the right direction.

Antwort schreiben

Anmelden um eine Antwort zu senden.