首頁 >後端開發 >Python教學 >什麼是UULE?以及如何用Python生成UULE?

什麼是UULE?以及如何用Python生成UULE?

WBOY
WBOY原創
2024-08-18 08:31:36571瀏覽

What is UULE? And how to generate UULE with Python?

What is UULE?

The UULE region parameter (&uule=) of the Google search engine allows you to see the actual search results by region, which corresponds to geolocation when directly located in an arbitrary region. In other words, it is possible to get search results for your region of interest in your browser without the need for additional plug-ins or directly physical presence in the region. [1]

Generate UULE with Python [2]

import base64

def uule(city: str) -> str:
  encoded_city = city.encode()
    city_length = len(encoded_city)
    hashed = (
        base64.standard_b64encode(
            bytearray([8, 2, 16, 32, 34, city_length]) + encoded_city
        )
        .decode()
        .strip("=")
        .replace("+", "-")
        .replace("/", "_")
    )
    return f"w+{hashed}"

Example

uule('Lezigne,Pays de la Loire,France') = w+CAIQICIfTGV6aWduZSxQYXlzIGRlIGxhIExvaXJlLEZyYW5jZQ

Google Search Results API

With Google SERP API you can get realtime results from around the without worrying about proxy, captcha or limitation.

References

[1] https://site-analyzer.pro/services-seo/uule/

[2] https://github.com/ogun/uule_grabber

以上是什麼是UULE?以及如何用Python生成UULE?的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn