Niconico geo-block & User-Agent spoofing
Back in late October 2024, Niconico put in place access restrictions to prevent any device-restricted videos (likely containing sensitive content) from being viewed outside of Japan. The full announcement can be read here.
However, in practice, because much of the Internet’s infrastructure is grounded in the US, this ended up breaking functionality even for users from Japan. One such example of this are Open Graph embeds.
Device-restricted video embeds have been broken on not only Twitter/X, but also Discord. Source
Because most social networking services proxy and cache their embeds via a web crawler, and most of these crawlers originate from an IP address located in the US, this causes embeds to break on almost every site. Niconico has no interest in fixing this, so I decided to look into creating a service to resolve this myself, much like other “embed fixer” projects that have popped up for Discord such as FxTwitter.
Just replace ‘.jp’ in a Niconico URL with ‘.gay’!
This service is available at https://www.nicovideo.gay/ — the root URL will redirect to my own site, but any other link, such as one to a video, will directly send you to Niconico’s site. Here’s an example: https://www.nicovideo.gay/watch/sm29250555
Currently, this service only fixes the thumbnail and nothing more. No new functionality is added, but I may consider it later. The goal for now was just to fix what previously worked.
The thumbnail fix was pretty simple: in the initial HTTP response of a Niconico video’s watch page, a JSON payload contained in a <meta>
tag with the name server-response
stores a bunch of data about the video, including the thumbnail URL. If you try to access a device-restricted video from a foreign IP, this data is absent. With a Japanese IP address, it is available.
Initially, I was under the assumption that true geo-blocking was implemented and I would in fact have to host this service in Japan and access Niconico with a IP address originating from Japan. It turns out, Niconico was extremely lazy implementing this. By simply spoofing the User-Agent
header with a common web crawler, i.e. Googlebot/2.1
, it completely bypasses the geo-block. This returns the JSON payload contained in the initial HTTP request.
What’s even more insane about this though… is this works in any standard web browser. No VPN is necessary. Niconico geo-blocking can be defeated entirely by simply setting your user agent to that of a common web crawler.
That server-response
payload mentioned earlier? It doesn’t contain only the thumbnail — it contains everything. Right now, you can watch any device-resticted Niconico video directly from an IP address originating outside of Japan.
Who knows how long this will last. Or if Niconico even cares. But for now… go watch American Gay Wrestling 2 from America while you still can!