2024年5月19日星期日

[yt-dlp]Investigation for logger output to log file

As Youtube-DL was not extended any more, I turned to yt-dlp also.

But it has an insufficient feature to output debug log to stdout. In my program, I need it to output debug log to log file instead of output to stdout.

After take some time to investigate the source, I found that I need to change one method in below file.

yt-dlp/yt_dlp/utils/_utils.py

Method: write_string

Its source below:

def write_string(s, out=None, encoding=None):

    assert isinstance(s, str)

    out = out or sys.stderr

    if not out:

        return


    if compat_os_name == 'nt' and supports_terminal_sequences(out):

        s = re.sub(r'([\r\n]+)', r' \1', s)


    enc, buffer = None, out

    if 'b' in (getattr(out, 'mode', None) or ''):

        enc = encoding or preferredencoding()

    elif hasattr(out, 'buffer'):

        buffer = out.buffer

        enc = encoding or getattr(out, 'encoding', None) or preferredencoding()


    buffer.write(s.encode(enc, 'ignore') if enc else s)

    out.flush()

As per the source, we can add out put log file parameter to it.


2024年5月17日星期五

[AWS EC2]Docker install

AWS EC2にDockerを利用して、Wordpressを使い始めたいと思いますので、AWS EC2にDockerインストールをメモしておきます。

1. EC2インスタンスにログインして、最新のyumリストを取得します。

$ sudo yum update -y

2. Docker packageインストールします。

$ sudo yum install -y docker

3. Dockerサービスを起動します。

$ sudo service docker start
Redirecting to /bin/systemctl start docker.service

4. Dockerグループにec2-userを追加します。

$ sudo usermod -a -G docker ec2-user

5. 一旦ログアウトして、再度ログインすることで、設定を有効化します。docker infoでdockerの起動を確認します。

exit

$ docker info
Client:
 Version:    25.0.3
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.0.0+unknown
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx

Server:
...
Although we did not face below issue, if you have the problem, please follow AWS guidance to restart the instance.

Cannot connect to the Docker daemon. Is the docker daemon running on this host?


The blog is follow on AWS guidance. Amazon ECS で使用するコンテナイメージの作成

2024年5月15日星期三

Youtube-dl Error

```

pi@raspberrypi:~/YoutubeDownLoad $ ./downloadYoutube_list.py 

Downloading https://www.youtube.com/watch?v=Y3mj8UZpvxQ

 MP4 start..

[youtube] Y3mj8UZpvxQ: Downloading webpage

ERROR: Unable to extract uploader id; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see  https://yt-dl.org/update  on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.

Unknown issue

Unexpected {err=}, {type(err)=}

1 : https://www.youtube.com/watch?v=Y3mj8UZpvxQ


Downloading https://www.youtube.com/watch?v=lrpfYD4DUGs

 MP4 start..

[youtube] lrpfYD4DUGs: Downloading webpage

ERROR: Unable to extract uploader id; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see  https://yt-dl.org/update  on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.

Unknown issue

Unexpected {err=}, {type(err)=}

2 : https://www.youtube.com/watch?v=lrpfYD4DUGs


pi@raspberrypi:~/YoutubeDownLoad $ sudo pip install yt-dlp

sudo: pip: command not found

pi@raspberrypi:~/YoutubeDownLoad $ sudo pip3 install yt-dlp

Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple

Collecting yt-dlp

  Downloading https://files.pythonhosted.org/packages/31/5a/d9b0a47a3aacf650b8ffc750bb5d296c24b2cc674f4c2a975895f49d4f0a/yt_dlp-2023.11.16-py2.py3-none-any.whl (3.1MB)

    100% |████████████████████████████████| 3.1MB 87kB/s 

Collecting brotli; implementation_name == "cpython" (from yt-dlp)

  Downloading https://www.piwheels.org/simple/brotli/Brotli-1.1.0-cp37-cp37m-linux_armv7l.whl (2.1MB)

    100% |████████████████████████████████| 2.1MB 126kB/s 

Collecting websockets (from yt-dlp)

  Downloading https://www.piwheels.org/simple/websockets/websockets-11.0.3-cp37-cp37m-linux_armv7l.whl (132kB)

    100% |████████████████████████████████| 133kB 173kB/s 

Collecting pycryptodomex (from yt-dlp)

  Downloading https://www.piwheels.org/simple/pycryptodomex/pycryptodomex-3.20.0-cp35-abi3-linux_armv7l.whl (2.0MB)

    100% |████████████████████████████████| 2.0MB 130kB/s 

Requirement already satisfied: certifi in /usr/local/lib/python3.7/dist-packages (from yt-dlp) (2022.12.7)

Collecting mutagen (from yt-dlp)

  Downloading https://files.pythonhosted.org/packages/b0/7a/620f945b96be1f6ee357d211d5bf74ab1b7fe72a9f1525aafbfe3aee6875/mutagen-1.47.0-py3-none-any.whl (194kB)

    100% |████████████████████████████████| 194kB 1.0MB/s 

Collecting urllib3<3,>=1.26.17 (from yt-dlp)

  Downloading https://files.pythonhosted.org/packages/d2/b2/b157855192a68541a91ba7b2bbcb91f1b4faa51f8bae38d8005c034be524/urllib3-2.0.7-py3-none-any.whl (124kB)

    100% |████████████████████████████████| 133kB 1.4MB/s 

Collecting requests<3,>=2.31.0 (from yt-dlp)

  Using cached https://files.pythonhosted.org/packages/70/8e/0e2d847013cb52cd35b38c009bb167a1a26b2ce6cd6965bf26b47bc0bf44/requests-2.31.0-py3-none-any.whl

Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.7/dist-packages (from requests<3,>=2.31.0->yt-dlp) (3.4)

Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.7/dist-packages (from requests<3,>=2.31.0->yt-dlp) (3.1.0)

selenium 4.8.2 has requirement urllib3[socks]~=1.26, but you'll have urllib3 2.0.7 which is incompatible.

google-api-core 2.11.1 has requirement google-auth<3.0.dev0,>=2.14.1, but you'll have google-auth 1.23.0 which is incompatible.

Installing collected packages: brotli, websockets, pycryptodomex, mutagen, urllib3, requests, yt-dlp

  Found existing installation: urllib3 1.26.14

    Uninstalling urllib3-1.26.14:

      Successfully uninstalled urllib3-1.26.14

  Found existing installation: requests 2.28.2

    Uninstalling requests-2.28.2:

      Successfully uninstalled requests-2.28.2

Successfully installed brotli-1.1.0 mutagen-1.47.0 pycryptodomex-3.20.0 requests-2.31.0 urllib3-2.0.7 websockets-11.0.3 yt-dlp-2023.11.16


```

2024年5月13日星期一

[VS CODE]HTMLをリアルタイムでプレビューする方法

Web制作の過程でリアルタイムプレビューを使いたい場合、Visual Studio Code(VS Code)の利用をおすすめです。

Visual Studio Code(VS Code)はマイクロソフトが提供している無料のコードエディタです。昔はAdobeのDreamWeaverを利用し、非常に高機能で使いやすかったが、MACのOSアップデートで、一括支払いバージョンからSaaSになって、高額で諦めました。

「コードエディタを使ってリアルタイムプレビューの環境を作る」と聞くと難しそうな印象を受けるかもしれませんが、実際は非常に簡単で3分ほどで完了します。

「VS CodeのUI上でプレビューする方法」があります。まずはVS Codeが必要なので、下記のページからダウンロードしてPCにインストールしましょう。



https://code.visualstudio.com/download

VS CodeのUI上でプレビューできる拡張機能もあります。ExtensionsからHTML Previewと検索し、下記が表示されたらインストールしてください。

ファイルに戻り、command + Shift + P(Windows:Ctrl + Shift + P)を押すと上に表示される検索窓から、HTML: Open Preview the the Sideを選択します。そうすると、右にプレビュー画面が出てきて、所見既所得....

DreamWeaverのような高機能ではありませんが、基本的なHTML、CSS、Javascriptについて、問題がありません。ただし、Pluginの開発は2018からすでに停滞しているので、いつかに使えなくなるのが心配です。

まだ、問題となりのがリンクです。プレビュー画面からリンクを経由でNext Pageの確認が不可です。全てAzureに誘導され、Azureの共有リンクから探しているようです。設定不備かエンジンのバグだと思います。

2024年5月10日星期五

[youtube-dl]Blocked?

 Just want to confirm if there is any newer version for YouTube-dl, unfortunately, it was blocked by de court...


It was shown that [Access denied] to yt-dl.org due to a ruling of the Hamburg Regional Court.

Access to this website is blocked.


So, we still have another way.

https://github.com/ytdl-org/youtube-dl

But it seems that it stopped development since 2021.

ーーーーーーーーーーーーーーーSuper beautiful seperate lineーーーーーーーーーーーー

After asked Google, I found the below repository.

yt_dlp

We can make some change on script to work on yt_dlp rather than Youtube_DL.

2024年5月6日星期一

[Panasonic]CF-SZ6 Fixed a SZ6 LCD Screen

Fixed a Panasonic CF-SZ6 LCD Screen, but found that although it passed the selftest, but failed on startup beep.

Why?

Changed the module board, but it can not work fine yet.

Maybe motherboard connecter broken.