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

Regex support for urltransform #2924

Closed
MasterKia opened this issue Nov 3, 2023 · 8 comments
Closed

Regex support for urltransform #2924

MasterKia opened this issue Nov 3, 2023 · 8 comments
Labels
enhancement New feature or request fixed issue has been addressed

Comments

@MasterKia
Copy link
Member

MasterKia commented Nov 3, 2023

#2923:

I want to change https://upera.shop/ref/3m8/ckz0oa1m to https://upera.shop/ckz0oa1m to prevent tracking, but I can't do this using $urltransform since it doesn't support regex.

They're the download links here:
https://www.doostihaa.com/post/1402/08/09/%d9%82%d8%b3%d9%85%d8%aa-18-%d9%85%da%af%d9%87-%d8%aa%d9%85%d9%88%d9%85-%d8%b9%d9%85%d8%b1-%da%86%d9%86%d8%af-%d8%aa%d8%a7-%d8%a8%d9%87%d8%a7%d8%b1%d9%87.html

3m8 is the tracking code for each site (many sites use the upera.shop download links).
ckz0oa1m is the video code.

A specific URL where the issue occurs.

https://upera.shop/ref/3m8/ckz0oa1m

@MasterKia MasterKia added the enhancement New feature or request label Nov 4, 2023
@MasterKia MasterKia changed the title regex support for urltransform Regex support for urltransform Nov 4, 2023
@MasterKia MasterKia changed the title Regex support for urltransform Regex support for urltransform Nov 4, 2023
@gorhill
Copy link
Member

gorhill commented Nov 4, 2023

What if urltransform uses the same syntax as replace=:

"/" regexp "/" replacement "/" modifiers

@u-RraaLL
Copy link
Contributor

u-RraaLL commented Nov 4, 2023

Is there any chance you'd consider either:

  • Allowing subdomain changes,
  • Forcing absolute links become relative?

Why I'm asking - a few days ago reddit made my account part of an experiment where they forced sh.reddit.com interface onto me. That interface is very incomplete and it made moderating quite difficult.

Other than contacting reddit to get to the bottom of it, I tried switching to the new.reddit.com domain. It worked only partially, because there's a number of absolute links used in that interface (including inside mod tools).

Before successfully making my case for getting me out of this experiment, I was considering my options and whether a userscript or installing Redirector was my only way out of this. So I'm just wondering if there'd be a way of doing it with uBO.

Since this would surely involve a lot of work for little benefit, please treat this as more of a theoretical question than a serious request.

@anewuser
Copy link

anewuser commented Nov 4, 2023

@u-RraaLL If you use Firefox, I recommend Request Control for this. The default example rules might be outdated, but it allows you to perform all sorts of advanced URL manipulations with very specific rules. I've created these for Old Reddit: reddit.txt. If you want to play with them, go to the Settings tab and use the Import rules option.

gorhill added a commit to gorhill/uBlock that referenced this issue Nov 5, 2023
@gorhill
Copy link
Member

gorhill commented Nov 5, 2023

I won't change the requirement that the resulting transformed URL has to be on the same domain, there are extensions specialized in this, this doesn't have to be undertaken by uBO, this would just open the door to a huge amount of added burden to maintainers because it would become expected uBO replace those specialized extensions.

Forcing absolute links become relative?

I don't understand that request, urltransform= works at the webRequest level, there are no relative URLs at that level.

@MasterKia
Copy link
Member Author

MasterKia commented Nov 6, 2023

a huge amount of added burden to maintainers

@gorhill Before [trusted]-set-cookie and local/session-storage was added, we declined cookice notices reports but now we address those. Ultimately it's up to us volunteers.

I won't change the requirement that the resulting transformed URL has to be on the same domain

That would address these and most strict-blocked redirect URLs that people complain about Peter Lowe's list.
#2678 (comment)
&
#2678 (comment)

@gorhill
Copy link
Member

gorhill commented Nov 6, 2023

I commented in the past about why I see burden ahead with opening the door to "bypass url-based trackers", see #1784 (comment). There will always be a case that is just one step away from whatever ability we add to urltransform, there will always be a request to extend to include that one-step-away case, and in the end urltransform will become an ugly pile of code to maintain. It's why I really see this as best taken care by a specialized extension.

If I was to add such capability, there would need to be a very solid argument that we are not going to go further than a very well defined ability.

@gwarser
Copy link

gwarser commented Nov 6, 2023

This is fixed now. ||youtube.com/shorts/$urltransform=/^\/shorts\/([^\/?]+)/\/watch?v=\$1/ works for YT shorts when navigated directly. @MasterKia ?

image

@gwarser gwarser closed this as completed Nov 6, 2023
@MasterKia MasterKia added the fixed issue has been addressed label Nov 6, 2023
@MasterKia
Copy link
Member Author

@gwarser Your filter works.

||upera.shop/ref/$doc,urltransform=/^\/ref\/[^\/]+//

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request fixed issue has been addressed
Projects
None yet
Development

No branches or pull requests

5 participants