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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM