2
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.

Nugetで取得したパッケージのライセンスファイルを取得するツールを作ってみた

Last updated at Posted at 2021-08-17

タイトルの通り。

Nugetで取得したパッケージのライセンスファイルをダウンロードしてくるツールを作った。

【悲報】2021/08/19 直前で気まぐれにメソッド化した処理がバグっており、動かない模様。。。。現在修正中。。。 -> 致命的なのは直した

ソースは以下。

自動化したかった操作は以下。

  • (1) Nugetのページでパッケージを検索(例えばNewtonsoft.Jsonの場合は以下)

  • (2) InfoのSource Repositoryをクリックして、リポジトリのURLを開く。

  • (3) リポジトリ内のライセンスファイルを取得。

Newtonsoft.Jsonの場合はLICENSE.md。

使った技術

nuspecファイルの解析

以下のページを参考にプロジェクトのURLを取得した。
https://docs.microsoft.com/ja-jp/nuget/reference/nuspec

GitHubのAPI

以下のAPIでコンテンツを取得した。
https://docs.github.com/ja/rest/reference/repos#community

できなかったこと

とりあえず100万以上DLされているパッケージを対象に実行してみたが、jQueryだけダメだった。

jQueryはプロジェクトURLがGithubじゃなかったので、GitHubのREST APIじゃライセンスファイルがとれなかった模様。

うーん、これ頑張れるのかなぁ・・・・

2
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
2
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?