再现隐私之争_反谷歌FLoC联盟: selenium谷歌浏览器报错: Error with Permissions-Policy header

问题

使用selenium操作无头模式(无界面模式)的谷歌浏览器时,控制台报如下错误:

"Error with Permissions-Policy header: Unrecognized feature: 'interest-cohort'."

原因(谷歌FLoC技术)

在被谷歌浏览器操纵的目标网页上,出现了响应头:permissions-policy: interest-cohort=(),拒绝了FLoC
在这里插入图片描述

解决

添加浏览器启动参数 --log-level=1--log-level=2 忽略此错误。

chrome_options.add_argument('--log-level=1')

https://peter.sh/experiments/chromium-command-line-switches/

谷歌FLoC技术:

目的

为区分不同用户群体,更加精准的推送广告,谷歌启用了新的追踪技术FLoC(同类群组联合学习 Federated Learning of Cohorts)以替代 cookie

原理

该技术使用算法查看用户浏览器历史记录,并将其与一组有类似浏览历史的人匹配,这样广告商就可以更好向用户进行广告推送。FLoC 可以帮助实现无 Cookie 和无同意的广告定位。

潜在风险

从技术角度而言,它比 Cookie 更私密,但如果实施不当,就有可能发生更加严重的隐私泄漏问题。

谷歌表示,不希望加入 FLoC 的网站可以发送以下 HTTP 标头:permissions-policy: interest-cohort=()

反谷歌 FLoC 联盟

出于对用户隐私的考虑,微软、Firefox、Brave、Vivaldi、Opera、WordPress、DuckDuckGo 等众多浏览器均对谷歌 FLoC 表示拒绝。我们称之为 反谷歌 FLoC 联盟

Brave表示:FLoC的糟糕之处,是打着隐私保护的幌子,而在实质上损害了用户的隐私;
Vivaldi认为Google的FLoC实际上是打着隐私保护的旗号侵犯隐私。偷摸着将自身的经济利益置于用户隐私之上。

添加响应头 permissions-policy: interest-cohort=() 的网站还有 Github, Amazon …

最后

如果您也认为隐私大过天,没有谷歌广告相关需求。不希望网站被跟踪,也赶紧在网站加上响应头:

permissions-policy: interest-cohort=()

“Error with Permissions-Policy header”, when using Chromedriver to a Headless Browser https://stackoverflow.com/questions/66997942/error-with-permissions-policy-header-when-using-chromedriver-to-a-headless-br

What is FLoC? https://web.dev/floc/
谷歌FLoC广告追踪技术遭多家浏览器厂商抵制 https://zhuanlan.zhihu.com/p/365949201

  • 4
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Python中,可以使用`rasterio`和`scipy`库来计算SPEI指数。下面是一个简单的示例代码: ```python import rasterio import numpy as np from scipy.stats import gamma, norm # 读取数据 with rasterio.open('precipitation.tif') as src: precipitation = src.read(1) with rasterio.open('pet.tif') as src: pet = src.read(1) with rasterio.open('temperature.tif') as src: temperature = src.read(1) # 将数据转换为DataFrame格式 precipitation_df = pd.DataFrame(precipitation.flatten(), columns=['precipitation']) pet_df = pd.DataFrame(pet.flatten(), columns=['pet']) temperature_df = pd.DataFrame(temperature.flatten(), columns=['temperature']) # 计算SPI和SPEI spi = (precipitation_df - precipitation_df.mean()) / precipitation_df.std() spei = (pet_df - pet_df.mean()) / pet_df.std() # 计算SPEI指数 gamma_params = gamma.fit(spi, floc=0) spi_gamma = gamma.cdf(spi, *gamma_params) spei_norm = norm.ppf(spei) alpha = 1 # 根据时间尺度确定 weights = alpha / (alpha + 1) spei_index = weights * spi_gamma + (1 - weights) * spei_norm # 将SPEI指数转换为tif格式并保存 profile = src.profile.copy() profile.update(dtype=rasterio.float32, count=1) with rasterio.open('spei.tif', 'w', **profile) as dst: spei_index_reshape = spei_index.values.reshape(precipitation.shape) dst.write(spei_index_reshape.astype(rasterio.float32), 1) ``` 注意,这只是一个简单的示例代码,实际使用中可能需要进行更多的数据预处理和参数调整。同时,还可以使用其他的Python库来读取和处理tif格式的数据,比如`gdal`和`xarray`等。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值