wget - 使用 wget 递归获取 .php 文件中的 .txt 文件,但过滤器会破坏命令
问题描述
我希望使用Bash shell从Salk Arabidopsis 1001 Genomes 站点quality_variant_[accession_name].txt
下载所有文件。wget
- 加入列表的主页:http: //signal.salk.edu/atg1001/download.php
- 每个加入链接到一个页面(例如,http: //signal.salk.edu/atg1001/data/Salk/accession.php?id=Aa_0,其中 Aa_0 是加入 ID)包含另外三个链接:unsequenced_[accession]、quality_variant_ [加入] 和 quality_variant_filtered_[加入]
- 我只对 quality_variant_[accession] 链接(不是 quality_variant_filtered_[accession] 链接)感兴趣,它会将您带到
.txt
包含序列数据的文件(例如,http ://signal.salk.edu/atg1001/data/Salk/quality_variant_Aa_0 .txt )
运行下面的命令,最终输出感兴趣的文件(但由于 --spider 参数而没有下载),证明wget
可以通过页面的超链接移动到我想要的文件。
wget --spider --recursive "http://signal.salk.edu/atg1001/download.php
我没有让命令运行足够长的时间来确定是否下载了感兴趣的文件,但是下面的命令确实开始递归下载站点。
# Arguments in brackets do not impact the performance of the command
wget -r [-e robots=off] [-m] [-np] [-nd] "http://signal.salk.edu/atg1001/download.php"
但是,每当我尝试应用过滤器来提取.txt
感兴趣的文件时,无论是使用--accept-regex
、--accept
还是许多其他变体,我都无法通过初始.php
文件。
# This and variants thereof do not work
wget -r -A "quality_variant_*.txt" "http://signal.salk.edu/atg1001/download.php"
# Returns:
# Saving to: ‘signal.salk.edu/atg1001/download.php.tmp’
# Removing signal.salk.edu/atg1001/download.php.tmp since it should be rejected.
我可以列出加入名称并循环访问这些名称以修改 wget 命令中的 URL,但我希望有一个动态的单行代码,即使随着时间的推移添加加入 ID,也可以提取所有感兴趣的文件。
谢谢!
注意:感兴趣的数据文件包含在目录中http://signal.salk.edu/atg1001/data/Salk/
,该目录.php
也是访问该 URL 时显示的静态 HTML 页面的主页。此 URL 不能在 wget 命令中使用,因为虽然感兴趣的数据文件包含在服务器端,但 HTML 页面不包含对这些文件的引用,而是链接到.txt
我不想要的一组不同的文件。
解决方案
推荐阅读
- python - 如何根据给定的用户输入让程序再次运行?
- spring-boot - Spring Async 获取当前 Executor
- unity3d - CS-Script 没有出现在添加组件搜索中?
- c++ - 如何以编程方式获取 Windows 命令行或 Windows 资源管理器的当前目录?
- javascript - 如何在调用 Apollo Graph QL Query 之前等待服务器响应?
- c++ - 如何反转邻接列表?
- css - 用于画廊的 CSS 网格 - 重复 15 个项目的选择器 - 并且 - 网格堆叠而不是在下方流动
- dax - 使用 PERCENTILEX.INC 进行异常值检测的 DAX 公式
- pyspark - 如何编写子字符串以获取从起始位置到结束的字符串
- javascript - Webpack - 从 .d.ts 文件导入 const 不起作用 - 无法解析 '@nuvolo/servicenow-types/server/GlideRecord'