thedaviddelta / lingva-translate

Alternative front-end for Google Translate
https://lingva.thedaviddelta.com
GNU Affero General Public License v3.0
1.52k stars 141 forks source link

How does it work to get data from google without using a google service? #67

Closed basings closed 2 years ago

basings commented 2 years ago

Following statement seems contradicting:

Lingva scrapes through GTranslate and retreives the translation without using any Google-related service

basings commented 2 years ago

line 15 in translate.ts fetches data from google. Hence, Lingva uses google services

    const res = await fetch(
        `https://translate.google.com/m?sl=${parsed.source}&tl=${parsed.target}&q=${encodeURIComponent(query)}`,
        {
            headers: {
                "User-Agent": new UserAgent().toString()
            }
        }
    ).catch(
        () => null
    );
basings commented 2 years ago

If you selfhost it, you just have another front-end, google still receives every request and tracks you via IP.

What about caching the results so that each subsequent run won't be tracked by google?

treuks commented 2 years ago

i'm not the developer or related to this project in any way shape or form, but what they meant by without using any Google-related service, is that this translation frontend works without using the google translate api, which costs money to use

thedaviddelta commented 2 years ago

Hi and thanks for your interest in the project.

Lingva works the same as Invidious, Nitter or Kainet. It doesn't use an official API with its own API key, which are used by these companies for tracking requests, but it makes an standard GET request to the own official page as a normal user would do from a web browser (indeed Invidious or Kainet use a private API but it's the same concept) and scrapes the returned HTML for getting the results.

In addition, these scrapers always make the requests from the backend. This way, they always come from the same "virtual user" (our backend's IP), without giving any info of the users that made the original request to them.

That's what we (and every scraper) mean by without using any Google-related service.

Regards, David.

basings commented 2 years ago

@TheDavidDelta ok, thx. The wording is incorrect. Lingva is using a google service. The user does not use google.

I am just trying to help. If you want you can write anything on that page of course

thedaviddelta commented 2 years ago

Yep, don't worry @basings. I didn't think about it but, even thought we don't strictly use any Google service but a public webpage, it's true it may be a bit misleading. I will take a look to a more proper wording after some interesting changes I have planed for the future.

Thanks, David.