News for hackers. Stuff that matters.
Re:Ask HN: Why is YouTube adding “&pp=sAQA” to video URLs? by cesarb on Friday July 30, 2021 @07:04AM (#28006671)
It's fairly annoying for other reasons than just shell quoting. For instance, I use the browser history to know whether I've already watched some video; this extra parameter makes all these video links appear to be unvisited to the browser (since back when I visited them, that useless extra parameter didn't exist).
Re:Ask HN: Why is YouTube adding “&pp=sAQA” to video URLs? by rasz on Friday July 30, 2021 @08:16AM (#28007127)
Yesterday after discovering &pp=sAQA breaking by History tracking (got a custom CSS injected to make sure its distinct) I added this

    document.querySelectorAll('a[href*=\\&pp\\=]').forEach(el => {el.href = decodeURIComponent("/watch?v="+el.href.match(/v=(.*?)(&|$)/)[1])})
to my userscript injected into YT. I still need to pinpoint reliable DOMSubtreeModified event to make it work without manually reloading the page.

Edit: and just now discovered its being added server side. Fetched https://www.youtube.com/youtubei/v1/browse?key=xxx already has &pp=sAQA, makes patching even easier, just donna hijack fetch and strip them in the handler... aaand done:

    const origFetch = unsafeWindow.fetch
    unsafeWindow.fetch = async (url, init) => {
      if (url.url.startsWith('https://www.youtube.com/youtubei/v1/browse?key=')) {
        let response = await (await origFetch(url)).text()
        response = response.replace(/(\&pp\=.*?)",/g,"\",")
        return new Response(response)
      }
      else {
        return origFetch(url)
      }
    }

    window.addEventListener('DOMContentLoaded', ()=> {
      if (document.location.pathname == "/feed/subscriptions") {
        document.querySelectorAll('a[href*=\\&pp\\=]').forEach(el => {el.href = decodeURIComponent("/watch?v="+el.href.match(/v=(.*?)(&|$)/)[1])})
      }
    })
Re:Ask HN: Why is YouTube adding “&pp=sAQA” to video URLs? by Sephr on Friday July 30, 2021 @08:26PM (#28014034)
Regular expression replaces on content are very fragile. Unfortunately, browsers do not yet provide general request regulation capabilities. Until then, Transcend Consent Manager's API can solve this much more easily with a more robust request-override based approach:

    self.airgap = {
      overrides: [{
        matcher: '//www.youtube.com/',
        override(request) {
          request.urls.forEach((input, i) => {
            const url = new URL(input, location.href);
            if (url.searchParams.has('pp')) {
              url.searchParams.delete('pp');
              request.urls[i] = url.href;
            }
          });
        }
      }]
    };
Re:Ask HN: Why is YouTube adding “&pp=sAQA” to video URLs? by rasz on Saturday July 31, 2021 @01:16AM (#28015486)
Its true URLSearchParams is a proper blessed way of working with url parameters, but its just my tiny userscript working on a serialized JSON, so either I grep and be done with it, or be forced to actually parse it, traverse huge Object looking for 100 individual URL fields to modify "properly", and stringlify once again. Im good with regex thank you :)

>Transcend Consent Manager's API

what is that?

>request-override based approach

the idea is to modify those URLs before they get rendered on the page, this way they get applied :visited style in the first place.

Re:Ask HN: Why is YouTube adding “&pp=sAQA” to video URLs? by Sephr on Saturday July 31, 2021 @12:58PM (#28019799)
> what is that?

A new consent management tool for website owners. We're currently in closed beta. Learn more here: https://transcend.io/blog/defeating-cookie-banners

> the idea is to modify those URLs before they get rendered on the page

These overrides are applied before the URLs are rendered on the page or trigger any requests.

Re:Ask HN: Why is YouTube adding “&pp=sAQA” to video URLs? by rasz on Sunday August 01, 2021 @12:22AM (#28023779)
>DOM nodes by directly patching the prototypes, methods, and accessors of all global element constructors and DOM tree construction utilities. We can write a patcher which overrides the constructor prototype, which allows us to check if the URL is allowed before the DOM mutation is performed.

Now I understand. Your product is aimed at corporations seeking more mature? compliance with privacy laws. Sounds like tough market.

Re:Ask HN: Why is YouTube adding “&pp=sAQA” to video URLs? by qwerty456127 on Friday July 30, 2021 @09:41AM (#28007837)
I actually find all kinds of browser history pollution a very serious problem rendering it almost useless (only useful the way "recycle bin" is - to recover an address of that useful page you have seen yesterday but forgotten).

I wish there were browser extensions capable to smartly sanitize the history by removing duplicate URLs pointing to the same actual page visited multiple times during the day and/or by via slightly different URLs, removing the specific parameters which can be removed without changing what does the link point to, rearranging the remaining parameters alphabetically, removing GMail and alike useless URLs, also normalizing the entry titles by removing everything but the actual article title (e.g. removing website name or moving it to an uniform place - always the beginning or always the end) etc.

Re:Ask HN: Why is YouTube adding “&pp=sAQA” to video URLs? by loonster on Friday July 30, 2021 @12:02PM (#28009409)
I like the way Vivaldi Browser presents history. So much easier to use than other browsers.
Re:Ask HN: Why is YouTube adding “&pp=sAQA” to video URLs? by _-david-_ on Friday July 30, 2021 @10:10PM (#28014585)
I haven't used Vivaldi before. Can you explain what is eaiser to use?
Re:Ask HN: Why is YouTube adding “&pp=sAQA” to video URLs? by loonster on Sunday August 01, 2021 @12:00AM (#28023694)
It's just organized better. There are some screenshots on the help page that show it better.

https://help.vivaldi.com/desktop/navigation/history/

Re:Ask HN: Why is YouTube adding “&pp=sAQA” to video URLs? by pmoriarty on Friday July 30, 2021 @08:06PM (#28013937)
I'd prefer that the browser be taken out of the equation completely.

The web browser is becoming just a shitty operating system, largely controlled by unaccountable megacorps who are primarily interested not in empowering users but in tracking them and serving them ads.

Re:Ask HN: Why is YouTube adding “&pp=sAQA” to video URLs? by folli on Friday July 30, 2021 @09:44PM (#28014460)
You can use curl if you don't like browsers. It just needs a lot of imagination to get an idea on how the site is supposed to look like.
Re:Ask HN: Why is YouTube adding “&pp=sAQA” to video URLs? by qwerty456127 on Saturday July 31, 2021 @09:38AM (#28018032)
Whatever, pmoriarty is right. Today a browser indeed is an operating system with its own GUI toolkit and a decentralized repository of apps (we call the web, most of the sites actually are apps today).

Perhaps if the web servers served something like QML/XAML/whatever (while other web servers serving just APIs for them to get/post the content) and there was an operating system command to run such an app by its URL, both the developers and the users might have a better experience. Or perhaps worse.

This way we might even have more than one standard competing: QML, XAML and whatever else would emerge (introducing new would be more viable) vs just HTML.

Re:Ask HN: Why is YouTube adding “&pp=sAQA” to video URLs? by Zealotux on Friday July 30, 2021 @07:33AM (#28006818)
It's not as good, but the history is pretty useful: https://www.youtube.com/feed/history
Re:Ask HN: Why is YouTube adding “&pp=sAQA” to video URLs? by cesarb on Friday July 30, 2021 @07:45AM (#28006911)
That link shows empty to me, since I've never logged into YouTube, and most of the time I'm not even logged into the Google account.

(I don't know if it's still the case, but I've heard that if you log into YouTube, and Google for some reason decides your real name is not your real name, you could lose access to your whole Google account; and at least to me, the Google Talk account was more important than being able to comment on YouTube videos.)

Re:Ask HN: Why is YouTube adding “&pp=sAQA” to video URLs? by Kye on Friday July 30, 2021 @08:51AM (#28007384)
I don't think that's been a thing for a long time.

https://en.wikipedia.org/wiki/Nymwars

Re:Ask HN: Why is YouTube adding “&pp=sAQA” to video URLs? by elric on Friday July 30, 2021 @09:04AM (#28007487)
Last I checked, it was impossible to create a YT/Google account without providing a (working) phone number. Which is even worse than requiring "real names" (which can at least be spoofed).
Re:Ask HN: Why is YouTube adding “&pp=sAQA” to video URLs? by ravedev on Friday July 30, 2021 @11:12AM (#28008861)
That depends. I’ve found that, while creating an account on an iOS device, providing a phone number isn’t required, but while creating an account via a desktop browser, it is.

It will probably depend on other factors as well such as IP, country, …

Re:Ask HN: Why is YouTube adding “&pp=sAQA” to video URLs? by rtsil on Friday July 30, 2021 @08:48PM (#28014163)
It was still possible as of six months or so ago, who knows what factors Google takes into account to decide whether to require a phone number or a simple email.
Re:Ask HN: Why is YouTube adding “&pp=sAQA” to video URLs? by Nowado on Friday July 30, 2021 @07:37AM (#28006845)
The absolute future of a proprietary service-specific history.
Re:Ask HN: Why is YouTube adding “&pp=sAQA” to video URLs? by jannes on Friday July 30, 2021 @08:34AM (#28007267)
That would require to be logged in to a Google account
Re:Ask HN: Why is YouTube adding “&pp=sAQA” to video URLs? by rvba on Friday July 30, 2021 @08:39AM (#28007294)
Does it work when a video was deleted?
Re:Ask HN: Why is YouTube adding “&pp=sAQA” to video URLs? by horlux on Friday July 30, 2021 @08:01AM (#28007021)
how do you use the history exactly?
Re:Ask HN: Why is YouTube adding “&pp=sAQA” to video URLs? by rasz on Friday July 30, 2021 @08:18AM (#28007146)
I inject this into YT

    // make VISITED links distinct
    //subscriptions/lists
    css += 'a#video-title {color: #167ac6!important;}';
    css += 'a:visited#video-title {color: #141761!important;}';
    //commenter channel name
    css += 'a#author-text {color: #167ac6!important;}';
    css += 'a:visited#author-text {color: #141761!important;}';
    //sidebar
    css += 'a #video-title {color: #167ac6!important;}';
    css += 'a:visited #video-title {color: #141761!important;}';
    
    css += '#content-text a, #description a {color: #167ac6!important;}';
    css += '#content-text a:visited, #description a:visited{color: #141761!important;}';
makes pretty clear which links are visited