My_Play_Lists ~BlackCatWhiteTail’s blog~

Talk About My Favorite Songs

User-Agentを偽装する

(1)はじめに(放送授業を手元のPCで視聴できない)

私が普段使っているPCのOSはlinux(cpuはintel、osはpop!_os)。

また、私は趣味で、日本最大手の某通信制大学の授業を受けている。

ここで問題がある。linuxがインストールされたPCでは、大学のオンラインで配信されている授業を視聴できないのである。

大学側がサポートするos、ブラウザのリストにlinuxが入っておらず、これが原因のようである。

(2)原因(ブラウザからのリクエスト中の情報で弾かれる)

手元のPCから大学サーバーへのリクエストの情報で弾かれていると推測された。

(3)解決策(User-Agentを偽装)

googleで調べてみると、やはり同じ問題を抱えた人がいた1

ブラウザからのリクエストの「User-Agent」を書き換えて、osとブラウザとを偽装すれば良いらしい。

ブラウザごとにやり方が異なる様である。一番簡単そうな、Chromeブラウザの拡張機能を用いることにした。

(4)Chrome拡張の利用法

User-Agentを偽装するChome拡張は多数ある。今回は以下を用いた2

2User Agent Switcher for Google Chrome™, https://chromewebstore.google.com/detail/user-agent-switcher-for-g/oolobapiojdnnempcokpajdiedgdiecl?hl=ja

Chrome拡張機能アイコンをブラウザのツールバーでピン留めする。

するとそのアイコンがURLバーの隣に表示される。

このアイコンをクリックして、そこで変更したいUser-Agentを入力する。

「元のユーザーエージェント」と「現在のユーザーエージェント」に入力欄があり、元のユーザーエージェントには手元のPCの情報が既に入力されている。自分は以下の通り出会った(Mozilla/5.0(X11;Linux x86_64)AppleWebKit/537.36(KHTML,like Gecko)Chrome/123.0.0.0Safari/537.36)

現在のユーザーエージェントに偽装したい情報を入力する。ネット上の情報を元に、適当に選んで、以下のようにした(Mozilla/5.0(Windows NT 10.0;Win64; x64)AppleWebKit/537.36(KHTML,like Gecko)Chrome/69.0.3497.100。

(5)結果 無事、linux環境でも授業動画を視聴できた。

参考

1Linux環境でも放送大学の授業を受けたい! - JUNのブログ, https://jun-networks.hatenablog.com/entry/2021/07/22/015619

[3]【User-Agent Switcher and Manager】UAを変更する拡張機能 | ナポリタン寿司のPC日記, https://www.naporitansushi.com/user-agent-switcher/

[4]各ブラウザのUserAgent一覧 #Chrome - Qiita, https://qiita.com/kapiecii/items/093ffd6f0b09ad775250

Translated with ChatGPT4.0

Introduction (Unable to Watch Broadcasted Lectures on My PC)

I use a PC running Linux (Intel CPU, Pop!_OS) as my primary computer. Additionally, I am taking courses from Japan's largest correspondence university as a hobby. However, there is a problem: I cannot watch the university's online lectures on my Linux-installed PC. This is because Linux is not included in the list of operating systems and browsers supported by the university.

Cause (Blocked by Information in the Browser Request)

It is presumed that the request sent from my PC to the university server is being blocked due to the information it contains.

Solution (Spoofing the User-Agent)

Research on Google revealed others facing the same issue1. It appears that modifying the "User-Agent" in the browser's request to spoof the operating system and browser might be the solution. The method varies by browser, but using a Chrome extension seemed the easiest approach.

Usage of Chrome Extension

There are several Chrome extensions for spoofing the User-Agent. I used the following one2: User Agent Switcher for Google Chrome™, available at https://chromewebstore.google.com/detail/user-agent-switcher-for-g/oolobapiojdnnempcokpajdiedgdiecl?hl=ja.

After pinning the extension's icon to Chrome's toolbar, it appears next to the URL bar. By clicking this icon, I can input the desired User-Agent. There are fields for "Original User-Agent" and "Current User-Agent". The "Original User-Agent" field automatically populates with my PC's information (Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36).

I chose to enter the following spoofed information in the "Current User-Agent" field based on information from the internet: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100.

Result

Successfully, I was able to watch the lecture videos on my Linux environment.

References

1 "I Want to Take University of the Air Classes on a Linux Environment!" - JUN's Blog, available at https://jun-networks.hatenablog.com/entry/2021/07/22/015619

2 User-Agent Switcher and Manager Chrome Extension, available at https://www.naporitansushi.com/user-agent-switcher/

[3] List of UserAgents for Various Browsers #Chrome - Qiita, available at https://qiita.com/kapiecii/items/093ffd6f0b09ad775250

 このウェブサイトについて

 練習用のサイトです.

 自分の好きな曲について感想を述べます.

 また,世に役に立つかもと考えたことも書きます.

 

TOP 1 To 5

Title Artist Album
ロックバンド 中村中 私を抱いて下さい
犬の生活 SEX MACHINEGUNS SEX MACHINEGUNS
Megalovania Toby Fox UNDERTALE Soundtrack
Bokura No Fly Away Base Ball Bear Bokura No Fly Away - single
人魚の檻 陰陽座 迦陵頻伽(Ka Ryo Bin Ga