arxiv 论文 快速下载

简单的说,就是 通过 chrome 插件将 arxiv 官网的链接自动重定向到中国镜像网站以实现论文快速下载

背景

arxiv (https://arxiv.org/)是一个收集计算机科学、物理学、数学和生物学等多个学科的论文预印本网站,主站点在康奈尔大学,在全球多个地方设置有镜像网站。对于深度学习专业,可以说绝大多数论文都是从 arxiv 上获取的,因此能够快速地访问 arxiv 非常重要。我们可以通过使用在中国区镜像站点(http://cn.arxiv.org ,由中科院理论物理所支持)来加速访问和下载,但是当在其他地方查询到 arxiv 链接时,如果每次都需要手动修改网址,会比较麻烦。因此这里推荐采用以下方法来解决上述问题。

解决方案

chrome 插件 tampermonkey(油猴) 是一款功能强大的脚本插件,可以通过脚本对浏览器上网页进行修改编辑等,更多介绍可以参考 https://zhuanlan.zhihu.com/p/28869740
因此,这里我们使用该插件对网页中的arxiv 链接进行重定向到 cn.arxiv.org

  1. 安装chrome 浏览器。推荐使用google chrome官方下载地址 ;如果无法访问,使用百度下载也可以。
  2. 安装tempermonkey插件,推荐使用 chrome webstore 官方网址;如果无法下载,在 crx4chrome 网站搜索并下载也可以,这里给出crx4chrome网站上tampermonkey插件的下载链接
  3. 添加 arxiv 重定向脚本。
    代码更新时间2017年12年04日,博主于2018年12月6日测试可实现自动转到pdf链接。代码需要全部复制粘贴,部分看似注释的代码也有用处,代码如下
 1 // ==UserScript==
 2 // @name        Redirect arxiv.org to CN.arxiv.org/pdf
 3 // @namespace   uso2usom
 4 // @description On any web page it will check if the clicked links goes to arxiv.org. If so, the link will be rewritten to point to cn.arxiv.org
 5 // @include     http://*.*
 6 // @include     https://*.*
 7 // @version     1.2
 8 // @grant       none
 9 // ==/UserScript==
10 
11 // This is a slightly brute force solution, but there is no other way to do it using only a userscript.
12 
13 // Release Notes
14 
15 // version 1.2
16 // Focus on pdf link only!
17 // Add '.pdf' link  automatically. Convenient for saving as pdf.
18 
19 // version 1.1
20 // Redirect arxiv.org to CN.arxiv.org
21 
22 document.body.addEventListener('mousedown', function(e){
23     var targ = e.target || e.srcElement;
24     if ( targ && targ.href && targ.href.match(/https?:\/\/arxiv.org\/pdf/) ) {
25         targ.href = targ.href.replace(/https?:\/\/arxiv\.org/, 'http://cn.arxiv.org');
26     }
27     if ( targ && targ.href && targ.href.match(/http?:\/\/arxiv.org\/pdf/) ) {
28         targ.href = targ.href.replace(/http?:\/\/arxiv\.org/, 'http://cn.arxiv.org');
29     }
30     if ( targ && targ.href && targ.href.match(/https?:\/\/arxiv.org\/abs/) ) {
31         targ.href = targ.href.replace(/https?:\/\/arxiv\.org\/abs/, 'http://cn.arxiv.org/pdf');
32     }
33     if ( targ && targ.href && targ.href.match(/http?:\/\/arxiv.org\/abs/) ) {
34         targ.href = targ.href.replace(/http?:\/\/arxiv\.org\/abs/, 'http://cn.arxiv.org/pdf');
35     }
36     if (targ && targ.href && targ.href.match(/http?:\/\/cn.arxiv.org\/pdf/) && !targ.href.match(/\.pdf/) )
37     {
38        targ.href = targ.href + '.pdf';
39     }
40 });

 

  4.测试配置是否成功,下面是arxiv上的一篇文章作为示例,点击看网址前面是否已经加上“cn.”前缀,点击pdf测试速度。该文章共57页,之后可以手动去掉“cn.”前缀对比速度。
   NIPS 2016 Tutorial: Generative Adversarial Networks   

  5.说明
     由于 http://cn.arxiv.org 并不是主站点,是 arxiv 在中国区的镜像,因此更新有大约半天的延迟,对于当天提交的文章,可能更新不及时。对于当天文章可以手动删除“cn.”前缀解决。
     如果出现 pdf 正在自动从源文件生成等提示,为正常现象,稍后即可获取pdf论文。

参考链接

 1.简书  https://www.jianshu.com/p/184799230f20 

   2.少数派 https://zhuanlan.zhihu.com/p/28869740

转载于:https://www.cnblogs.com/jngwl/articles/10080357.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值