linux - 无法使用 wget 下载 git hub 搜索结果

标签 linux git github wget

我正在尝试使用 wget 将 github 代码搜索结果下载到日志文件中。

我一直在使用以下命令:

    wget -o logfile -r -l 2 https://github.com/search?l=Dockerfile&q=openjdk&type=Code&utf8=%E2%9C%93

但是,我得到了一个 robots.txt 文件,其中包含以下内容:

# 如果您想抓取 GitHub,请通过 support@github.com 与我们联系。

# 我们还提供了广泛的 API:https://developer.github.com/

为此我需要获得 github 的某种许可吗? 有人可以帮忙吗?

最佳答案

我认为信息非常明确:您正在尝试抓取 GitHub 网站,但他们不喜欢这样做。

他们建议您使用 GraphQL API .

v3 API仍然是休息,所以你可以这样做:

wget --output-document search-results.json --user <YOUR_GITHUB_ID> \
"https://api.github.com/search/code?q=openjdk+language:Dockerfile"

关于linux - 无法使用 wget 下载 git hub 搜索结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44802118/

相关文章:

git - 如何删除 GitHub 上的推送提交?

git - 允许 Github 组织读取存储库

regex - 检查字符串是否可以是 linux 和 windows 上 FS 中的路径

android - 在 Android build.gradle 中使用 `git describe --match`

git - 在 Azure DevOps 中发布的 Git 分支未在 VS2013 或 Git 命令行中显示

git - 为什么我不能在 Git 中克隆任何存储库?

使用linux终端编译问题

linux - 如何在 jhbuild 上安装库?

C++。避免多个文件项目中的交叉链接

github - 有没有办法在没有受让人的情况下显示所有 GitHub 票证?