1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

YouTube関係のGitリポジトリを試してみたメモ

Last updated at Posted at 2021-06-21

環境:MacBook Pro (16-inch, 2019) & macOS Catalina 10.15.7

dineshssdn-867/Sentiment_analysis_of_youtubers_webapp

  • 結果:利用できず
  • 中身はDjango(Python)で作成されている
  • 判断ポイント:ルート(最上位階層)またはバックエンド用のディレクトリに「manage.py」があること

前提

起動方法

ターミナルにて

  1. $ git clone https://github.com/dineshssdn-867/Sentiment_analysis_of_youtubers_webapp.git
    もしくはどこかのフォルダにZIPダウンロードして解凍
  2. $ cd Sentiment_analysis_of_youtubers_webapp
  3. $ pip3 install django django-pwa psycopg2-binary ktrain tensorflow TBB PyQt5
  4. $ python3 manage.py runserver

ここで通常なら起動するがエラーが発生する:

ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 88 from C header, got 80 from PyObject

原因はNumPyの最新バージョンでC向けAPIが使えなくなったためにNumPyに依存する周囲の他パッケージがエラーを吐いていることによる。

今回のエラーは sklearn.utils.murmurhash にて発生しているため、対象の scikit-learn を公式案内の方法で再インストールする。
https://scikit-learn.org/0.16/install.html

自分の環境はMac OS Xのため pip install -U numpy scipy scikit-learn を実行したのち、もう一度Django起動を試してみる。

Exception: Failed to load .preproc file in either the post v0.16.x loction (models/my_new_predictor_emotion/tf_model.preproc) or pre v0.16.x location (models/my_new_predictor_emotion.preproc)

モデル my_new_predictor_emotion.preproc を読み込めなかったとのことだが、公開されているこの機械学習データと思しきものが見つからなかったためここで断念。

参考

jacob-ian/TranscryptApp

  • 結果:すぐ起動可能
  • Angular.js + TypeScript 構成
  • 判断ポイント:ルートディレクトリに「angular.json」がある。(また、GitHub右カラムにある言語構成で7割ほどが "TypeScript" となっている)

起動方法

  1. $ git clone & $ cd (割愛:1つ目を参考に)
  2. $ npm i で依存関係をインストール
  3. $ npm run start でサーバーを起動
    Angularの場合デフォルトで http://localhost:4200/ でサーブされる。

結果

Screen Shot 2021-06-22 at 1.02.57.png

参考

yatharthrawat/React-Django_YoutubeCommentAnalysis

  • 結果:起動するがGoogle認証関係のファイルが無いエラーが出る。
  • まず backendfrontend の2フォルダがあることから、フロントとバックの2つにシステムが分かれていることがわかる。それらの中身をのぞくと、バックエンドは1つめリポジトリと同様でDjango(Python)、フロントエンドはNode.jsであることがわかる。
  • 判断ポイント:frontendディレクトリには package.json があり、backendディレクトリには manage.py がある。

前提

  • pipenvをインストールしておく
    $ pip3 install pipenv
  • 環境によってはデフォルトのPythonのパスを指定しておく必要がある
    $ pipenv --python /usr/local/bin/python3(PCによる)

バックエンド

  1. $ cd React-Django_YoutubeCommentAnalysis/backend
  2. 依存関係のパッケージをまとめてインストールする
    $ pipenv install
  3. それでもまだインストールしきれない依存関係がいろいろとあるので、エラーが出次第でインストール。こちらの環境では次のようになった:$ pip3 install django-cors-headers djangorestframework django-rest-utils google-api-python-client
  4. このままだとホワイトリストURLのスキームがおかしいというエラーが出るため、 Comment_API/settings.py の75〜77行目の3行を以下と置き換えて上書き保存。
CORS_ORIGIN_WHITELIST = [
  'http://localhost:3000'
]

これができたら $ python3 manage.py runserver でバックエンドを起動したままにしておく。http://127.0.0.1:8000/ でアクセス可能となるはず。

フロントエンド

バックエンド起動状態で、新しいターミナルから実行:

  1. $ cd React-Django_YoutubeCommentAnalysis/frontend
  2. $ npm i で依存関係をインストール
  3. $ npm run start でサーバーを起動
  4. こちらの環境では自動的に「Google Chrome」でhttp://localhost:3000/を開く動作を確認できた。

結果

Screen Shot 2021-06-22 at 2.30.48.png

Webアプリとして起動はするが、YouTubeのURLをいれるとバックエンド側でエラーが出る。

File "/usr/local/lib/python3.9/site-packages/google_auth_oauthlib/flow.py", line 203, in from_client_secrets_file
    with open(client_secrets_file, "r") as json_file:
FileNotFoundError: [Errno 2] No such file or directory: 'client_secret.json'

見たところでは、GoogleのAPIを自分で設定して client_secret.json に自分のAPIのシークレットを入れなければいけないような感じの仕様になっているっぽい。これ以上はタイムアウト(すみません)

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?