[Wallapop] CDN: request individual images of articles of the highest resolution possible

On cdn.wallapop.com, whenever pictureSize=W<number> and number < 1024, replace with W1024, to view individual pictures of items at higher resolution than provided by default.

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         [Wallapop] CDN: request individual images of articles of the highest resolution possible
// @description  On cdn.wallapop.com, whenever pictureSize=W<number> and number < 1024, replace with W1024, to view individual pictures of items at higher resolution than provided by default.
// @icon         https://www.google.com/s2/favicons?sz=32&domain_url=wallapop.com
// @icon64       https://www.google.com/s2/favicons?sz=64&domain_url=wallapop.com
// @author       nooobye
// @namespace    https://greasyfork.org/en/scripts/545851-wallapop-cdn-upgrade-smaller-w-sizes-to-w1024
// @version      2025-08-18
// @match        https://cdn.wallapop.com/*
// @run-at       document-start
// @noframes
// @grant        none
// @license      MIT
// ==/UserScript==

(function () {
  try {
    const url = new URL(location.href);
    const ps = url.searchParams.get('pictureSize');
    if (ps && ps.startsWith('W')) {
      const num = parseInt(ps.slice(1), 10);
      // Only sizes of W640 and W800 have been seen
      if (!isNaN(num) && num < 1024) {
        url.searchParams.set('pictureSize', 'W1024');
        if (url.href !== location.href) {
          location.replace(url.href);
        }
      }
    }
  } catch (e) {
    // no-op
  }
})();