├── list_fast ├── list_blocked ├── scihub_ck ├── ck_fast.sh ├── ck_all.sh ├── essay ├── 20180307.md └── 20180201.md ├── README.md ├── list_all ├── css └── me.css ├── index.html └── data2index.pl /list_fast: -------------------------------------------------------------------------------- 1 | tw 2 | se 3 | -------------------------------------------------------------------------------- /list_blocked: -------------------------------------------------------------------------------- 1 | mn 2 | bz 3 | cc 4 | io 5 | is 6 | nu 7 | nz 8 | ws 9 | ga 10 | hk 11 | nu 12 | ooo 13 | mu 14 | <<<<<<< HEAD 15 | is 16 | shop 17 | ======= 18 | >>>>>>> 53d8f37a69a1e45a59353e016499d83ac1936575 19 | fun 20 | -------------------------------------------------------------------------------- /scihub_ck: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | #use warnings; 4 | use strict; 5 | print "\rRead list file:\tREADING"; 6 | 7 | open LIST, "<$ARGV[0]"; 8 | 9 | my @domains; 10 | 11 | while ( ) { 12 | chomp; 13 | $domains[$.-1] = $_; 14 | } 15 | 16 | close LIST; 17 | print "\r \t "; 18 | print "\rRead list file:\tDONE\n"; 19 | 20 | #print "@domains"; 21 | my $max = @domains; 22 | my $i=0; 23 | foreach my $domain ( @domains ) { 24 | # print $domain, "\t"; 25 | my $site = "http://sci-hub.$domain"; 26 | system("timeout 3 curl --connect-timeout 2 $site -o web/$domain 2>/dev/null"); 27 | printf "\rCheck working domains:\t%d(%.2f%)", $i, $i/$max*100; 28 | $i++; 29 | } 30 | print "\rCheck working domains:\t$max(100%)\n"; 31 | -------------------------------------------------------------------------------- /ck_fast.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # by Wadauk @ https://weibo.com/u/1657589804 3 | 4 | cd /home/scihub-ck/Git/scihub_ck 5 | 6 | # pull 7 | git pull origin 8 | 9 | # check the speed 10 | for domain in `cat list_fast`; \ 11 | do \ 12 | curl -o /dev/null -s -w '%{time_total}\n' "http://sci-hub.$domain" >> sp.txt; \ 13 | done; 14 | 15 | # combine the result in one file 16 | paste list_fast sp.txt > data.txt 17 | 18 | # sort the domains by speed 19 | sort -k2n data.txt > data2.txt 20 | 21 | # creat web by data 22 | perl data2index.pl data2.txt > index.html 23 | 24 | # remove temp files 25 | yes | rm *.txt 26 | 27 | # upload to github 28 | #git status 29 | git add index.html 30 | #git status 31 | git commit -m "this is my commit info note." 32 | git push origin 33 | -------------------------------------------------------------------------------- /ck_all.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # by Wadauk @ https://weibo.com/u/1657589804 3 | 4 | cd /home/scihub-ck/Git/scihub_ck 5 | 6 | # pull 7 | git pull origin 8 | 9 | mkdir web 10 | 11 | # check all the domains 12 | perl scihub_ck list_all 13 | 14 | # remove the other domains 15 | cd web 16 | yes \ 17 | | rm `ls -l \ 18 | | grep -v 26860 \ 19 | | grep -v total \ 20 | | sed -e "s/.* //"` 21 | 22 | # check the speed 23 | for domain in `ls | grep -v .txt`; \ 24 | do \ 25 | echo $domain >> dm.txt; \ 26 | curl -o /dev/null -s -w '%{time_total}\n' "http://sci-hub.$domain" >> sp.txt; \ 27 | done; 28 | 29 | # combine the result in one file 30 | cp dm.txt ../list_fast 31 | paste dm.txt sp.txt > data.txt 32 | 33 | # sort the domains by speed 34 | sort -k2n data.txt > data2.txt 35 | 36 | # creat web by data 37 | cd .. 38 | perl data2index.pl web/data2.txt > index.html 39 | 40 | # remove temp files 41 | yes | rm web/* 42 | yes | rm -r web 43 | 44 | # upload to github 45 | #git status 46 | git add index.html list_fast 47 | #git status 48 | git commit -m "this is my commit info note." 49 | git push origin 50 | -------------------------------------------------------------------------------- /essay/20180307.md: -------------------------------------------------------------------------------- 1 | # 20180307 2 | ## 版本 3 | version 1.0.5.20180303_alpha 4 | 5 | ## 感想 6 | 版本稳定了就停止开发了吗?不。这不只是一个实用便利的工具,也是我技能综合运用的体现,以及未来学习方向的指引。 7 | 8 | ## 功能 9 | 相较于上一个稳定版本1.0.0.20180201_alpha,本版本有以下几点功能完善: 10 | 1. 运行提速:由最初的40-60分钟耗时,通过几个版本的优化,缩短到现在不到20秒 11 | 2. 周期缩短:受限于运行耗时,网站更新周期原先只能2小时一次,现在提升到每分钟一次,24小时不间断 12 | 3. 稳定性提高:过年期间稳定运行了20天,年后回来连着网站挂了3次,有时不在机器旁边无法维护,一狠心买了五年云服务器,把代码从天天担心着火的树莓派搬到了阿里云,只要有网络可以随时维护,无需担心断网断电 13 | 4. 策略改进:大改了代码和列表文件,发现没有必要每次都把262个域名都遍历,scihub也不是每分钟都换域名,全部域名的遍历每天一次就好,所以定在了每天睡觉人最多的凌晨4点进行全部域名的遍历,检测当天能用的域名地址,之后就是每分钟检测大约10-12个域名的速度,去除了其他多余的代码块,加了一些运行进程的提示 14 | 15 | ## 问题 16 | 问题仍然有: 17 | 1. 3月5日发现hk和ws失效,发生在全域名检测之后,于是后续每次快速检测都没剔除这两个域名,还需要加深对curl的理解,之后加个条件句,严谨一下,不过这类问题在第二天全域名检测后就不存在了 18 | 2. 全域名检测有的时候会漏掉个别很慢的域名,因为限时3秒钟响应,慢一次不代表次次慢,后续可以多进行几次全域名检测,然后汇总一下,确保当天信息最全 19 | 3. 服务器在新加坡,新加坡对于各网站响应的速度只能代表新加坡,不能代表国内,有的网站国外能访问,国内不一定,所以有时点开排名第二的域名反而比第一还快,秒开,不过排名最后的在国内也确实还是最后,有点误差但也不是差很大 20 | 4. 现在判断网站是否为真网站的方法简单粗暴,就看文件大小是不是26860b,后续还需要严谨一点,多设置几种checkpoint,以防恶意网站 21 | 5. 前端设计有冗余代码,还有不必要的样式引用,访问耗时也要1秒钟,移动端自适应也不够友好,考虑套用github自带的模版会不会好些 22 | 23 | ## 计划 24 | 1. 加强前端知识,简化美化网页 25 | 2. 加强curl理解,完善域名有效性判断 26 | 3. 加强js理解,增加数据可视化展示 27 | 4. 加强c理解,重写代码 28 | 5. 加强数据库理解,增加数据库支持 29 | 30 | ## 感想 31 | scihub_ck的更新到现在基本稳定了,后续一段时间(数月)也多数是一些小问题的日常维护,再较大幅度的提升,就需要新的技能积累了。下一步可能是一个更炫酷的页面,或者详尽的数据分析展示,或者更迅速的程序,或者后台稳定的数据库支持。 32 | -------------------------------------------------------------------------------- /essay/20180201.md: -------------------------------------------------------------------------------- 1 | # 20180201 2 | ## 版本 3 | version 1.0.0.20180201_alpha 4 | 5 | ## 感想 6 | 随着在线功能的加入,Scihub_ck完成了第一个版本的开发。 7 | 8 | ### 功能 9 | Scihub_ck目前具有如下功能: 10 | 1. 从262个域名中检查可用域名 11 | 2. 对可用域名进行访问速度测试 12 | 3. 本地版半自动地获得结果 13 | 4. 在线版自动获得按访问速度排序的结果 14 | 15 | ### 问题 16 | 反复思考审视,目前的版本还存在一些问题: 17 | 1. 域名覆盖度可能不全 18 | 2. 本地版自动化程度不高 19 | 3. 本地版平台兼容不好 20 | 4. 访问速度测试存在误差 21 | 5. 网页移动端展示比例无调整 22 | 6. 无可视化图表展示 23 | 7. 运行速度太慢 24 | 25 | ### 方案 26 | 针对以上问题,逐条讨论解决方案: 27 | 1. 域名覆盖度不全的问题,在Sci-hub网站目前还不是特别严重。按之前的规律,Sci-hub通常采用国家一级域名。所以这个问题先放放。 28 | 2. 本地版自动化程度的提高,将在线版的自动更新脚本修改一下,上传到github即可。 29 | 3. 本地版平台兼容性的提高,困难比较大,因为核心工具依赖了curl命令,在windows系统上估计有问题。尝试用Perl把curl的网页下载和网页访问测速的功能重写一下,还需要把文件筛选(ls、grep)、文件清除(rm)重写一下。重写完打包成exe文件。(否定)这种办法太费事了。不如再把Docker好好看一看,打包到docker,代码什么的还是linux系统更舒适。所以这一条也不管了,先优化别的,最后用docker打包一下,就算间接解决平台问题了。 30 | 4. 访问速度的误差问题,是因为测试访问速度的时候没有做重复,应该重复5次,取一个平均值。(否定)单单这样还不行。每个时段的网速是不一致的,需要进行矫正。应该以某一个网站(比如百度)为基准,测试5次取平均代表瞬间的网速水平,以基准网速对每个网站的访问速度进行标准化,具体的标准化方法还没想。 31 | 5. 网页移动端展示比例的问题,可以加上js的代码部分,或者再研究一下html和css,试一试挂在github上能不能自动调整,肯定是有方法的,其他挂在github上的网站就没这个问题。这个问题随缘,慢慢解决。 32 | 6. 可视化图的展示问题,希望用js实现交互式的展示,但是github可能不支持,所以目前比较方便的实现方法就是在本地跑R画好图,贴到相应的位置就好。最近想过几种图:(1)各可用域名访问速度的近24小时的折线图;(2)各可用域名近一年的访问速度热图[仿Github用户活跃度图];(3)各可用域名近24小时的访问速度热图[仿新浪用户活跃度图];(4)词云。 33 | 7. 运行速度的问题,通过调整策略进行改善。每天凌晨3点、中午12点、下午5点,运行不限时的全域名检查(目前是每次都运行全域名检查,但限时不超过3秒响应)。其他时段根据全域名检查结果,只检测更新有效域名(通常10个左右),这样耗时就可以从原先的15分钟缩短到2分钟以内,可以将更新频率由原先的2小时一次,加密到5分钟一次。需要注意将两个策略的程序及数据做好分隔,以防冲突。不过不知道更新这么频繁会不会被封号? 34 | 35 | ### 总结 36 | 完成了基本功能,可以使用了,后续就是一点点优化完善。词云的想法最有意思,两步走的策略最有益于提升效率,本地化版本自动化最容易实现,先把这个问题解决,在线版的美化问题,一点点来。 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # scihub_ck 2 | 3 | 一个简版的Sci-hub可用域名检查工具。 4 | 5 | Scihub_ck is a tiny tool for checking the working domain of sci-hub. Sci-Hub is a website with over 64.5 million academic papers and articles available for direct download. In 2015 academic publisher Elsevier filed a legal complaint in New York City against Sci-Hub alleging copyright infringement, and the subsequent lawsuit led to a loss of the original sci-hub.org domain. Following the first domain loss, Sci-Hub has cycled through a number of domains, some of which have been blocked in certain countries. 6 | For check the working domains timely, I developed the tiny tool based on Shell and Perl. 7 | 8 | ## Usage 9 | 10 | 使用方法: 11 | 12 | `perl scihub_ck list_all` 13 | 14 | 15 | ## Description 16 | 17 | 列表文件包括262个域名后缀供检查。运行产生的文件将保存在web文件夹内。程序运行完成后,保留大小为27kb的文件即为可用域名。 18 | 19 | The list file contained 262 domains to check. The output file will be generated into the 'web' directory. The files with 27 kb are corresponding to the working domains. 20 | 21 | 22 | ## Working domains 23 | 24 | > Update every minute 25 | 26 | Online version is available now: https://wadauk.github.io/scihub_ck/index.html 27 | 28 | 29 | ## Versions 30 | 31 | ### v1.0.0 32 | 33 | local version 34 | 35 | 本地版发布 36 | 37 | 38 | ### v1.0.1 39 | 40 | add online version 41 | 42 | 增加在线版 43 | 44 | 45 | ### v1.0.2 46 | 47 | add pipeline shell script for local version 48 | 49 | 增加本地版流程脚本 50 | 51 | 52 | ### v1.0.3 53 | 54 | speed up and shorten the update cycle for online version 55 | 56 | 提速并缩短在线版更新周期 57 | 58 | ### v1.0.4 59 | 60 | move the codes from pi to cloud and speed up 61 | 62 | 代码迁移至阿里云并提速 63 | 64 | ### v1.0.5 65 | 66 | High speed and stable version. New strategy to speed up. Every fast check only need less than 20 seconds! 67 | 68 | 高速稳定版本 69 | -------------------------------------------------------------------------------- /list_all: -------------------------------------------------------------------------------- 1 | ac 2 | ad 3 | ae 4 | aero 5 | af 6 | ag 7 | ai 8 | al 9 | am 10 | an 11 | ao 12 | aq 13 | ar 14 | as 15 | at 16 | au 17 | aw 18 | az 19 | ba 20 | bb 21 | bd 22 | be 23 | bf 24 | bg 25 | bh 26 | bi 27 | biz 28 | bj 29 | bm 30 | bn 31 | bo 32 | br 33 | bs 34 | bt 35 | bv 36 | bw 37 | by 38 | bz 39 | ca 40 | cc 41 | cd 42 | cf 43 | cg 44 | ch 45 | ci 46 | ck 47 | cl 48 | cm 49 | cn 50 | co 51 | com 52 | coop 53 | cr 54 | cu 55 | cv 56 | cx 57 | cy 58 | cz 59 | de 60 | dj 61 | dk 62 | dm 63 | do 64 | dz 65 | ec 66 | edu 67 | ee 68 | eg 69 | eh 70 | er 71 | es 72 | et 73 | eu 74 | fi 75 | fj 76 | fk 77 | fm 78 | fo 79 | fr 80 | gd 81 | ge 82 | gf 83 | gg 84 | gh 85 | gi 86 | gl 87 | gm 88 | gn 89 | gov 90 | gp 91 | gq 92 | gr 93 | gs 94 | gt 95 | gu 96 | gw 97 | gy 98 | hk 99 | hm 100 | hn 101 | hr 102 | ht 103 | hu 104 | id 105 | idv 106 | ie 107 | il 108 | im 109 | in 110 | info 111 | int 112 | io 113 | iq 114 | ir 115 | it 116 | je 117 | jm 118 | jo 119 | jp 120 | ke 121 | kg 122 | kh 123 | ki 124 | km 125 | kn 126 | kp 127 | kr 128 | kw 129 | ky 130 | kz 131 | la 132 | lb 133 | lc 134 | li 135 | lk 136 | lr 137 | ls 138 | lt 139 | lu 140 | lv 141 | ly 142 | ma 143 | mc 144 | md 145 | mg 146 | mh 147 | mil 148 | mk 149 | ml 150 | mm 151 | mn 152 | mo 153 | mp 154 | mq 155 | mr 156 | ms 157 | mt 158 | mu 159 | museum 160 | mv 161 | mw 162 | mx 163 | my 164 | mz 165 | na 166 | name 167 | nc 168 | ne 169 | net 170 | nf 171 | ng 172 | ni 173 | nl 174 | no 175 | np 176 | nr 177 | om 178 | org 179 | pa 180 | pe 181 | pf 182 | pg 183 | ph 184 | pk 185 | pl 186 | pm 187 | pn 188 | pr 189 | pro 190 | ps 191 | pt 192 | pw 193 | py 194 | qa 195 | re 196 | ro 197 | ru 198 | rw 199 | sa 200 | sb 201 | sc 202 | sd 203 | se 204 | sg 205 | sh 206 | si 207 | sj 208 | sk 209 | sl 210 | sm 211 | sn 212 | so 213 | sr 214 | st 215 | sv 216 | sy 217 | sz 218 | tc 219 | td 220 | tf 221 | tg 222 | th 223 | tj 224 | tk 225 | tl 226 | tm 227 | tn 228 | to 229 | tp 230 | tr 231 | tt 232 | tv 233 | tw 234 | tz 235 | ua 236 | ug 237 | uk 238 | um 239 | us 240 | uy 241 | uz 242 | va 243 | vc 244 | ve 245 | vg 246 | vi 247 | vn 248 | vu 249 | wf 250 | xxx 251 | ye 252 | yr 253 | yt 254 | yu 255 | za 256 | zm 257 | zw 258 | -------------------------------------------------------------------------------- /css/me.css: -------------------------------------------------------------------------------- 1 | 2 | .m-padded-tiny { 3 | padding: 0.3em !important; 4 | } 5 | 6 | .m-padded-tb-mini{ 7 | padding-top: 0.2em !important; 8 | padding-bottom: 0.2em !important; 9 | } 10 | 11 | .m-padded-tb-tiny { 12 | padding-top: 0.3em !important; 13 | padding-bottom: 0.3em !important; 14 | } 15 | 16 | .m-padded-tb-small { 17 | padding-top: 0.5em !important; 18 | padding-bottom: 0.5em !important; 19 | } 20 | 21 | .m-padded-tb { 22 | padding-top: 1em !important; 23 | padding-bottom: 1em !important; 24 | } 25 | 26 | .m-padded-tb-large { 27 | padding-top: 2em !important; 28 | padding-bottom: 2em !important; 29 | } 30 | 31 | .m-padded-tb-big { 32 | padding-top: 3em !important; 33 | padding-bottom: 3em !important; 34 | } 35 | 36 | .m-padded-tb-huge { 37 | padding-top: 4em !important; 38 | padding-bottom: 4em !important; 39 | } 40 | 41 | .m-padded-tb-massive { 42 | padding-top: 5em !important; 43 | padding-bottom: 5em !important; 44 | } 45 | 46 | .m-padded-lr-responsive { 47 | padding-left: 4em !important; 48 | padding-right: 4em !important; 49 | } 50 | /*------text------*/ 51 | 52 | .m-text { 53 | font-weight: 300 !important; 54 | letter-spacing: 1px !important; 55 | opacity: 0.8 !important; 56 | } 57 | 58 | .m-text-thin { 59 | font-weight: 300 !important; 60 | } 61 | 62 | .m-text-spaced { 63 | letter-spacing: 1px !important; 64 | } 65 | 66 | .m-text-lined { 67 | line-height: 1.8; 68 | } 69 | 70 | /*------margin------*/ 71 | 72 | .m-margin-top-small { 73 | margin-top: 0.5em !important; 74 | } 75 | 76 | .m-margin-top { 77 | margin-top: 1em !important; 78 | } 79 | 80 | .m-margin-top-large { 81 | margin-top: 2em !important; 82 | } 83 | 84 | .m-margin-tb-tiny { 85 | margin-top: 0.3em !important; 86 | margin-bottom: 0.3em !important; 87 | } 88 | 89 | /*------opacity------*/ 90 | .m-opacity-mini { 91 | opacity: 0.8 !important; 92 | } 93 | 94 | .m-opacity-tiny { 95 | opacity: 0.6 !important; 96 | } 97 | 98 | /*------position------*/ 99 | .m-right-top { 100 | position: absolute; 101 | top: 0; 102 | right: 0; 103 | } 104 | 105 | /*------display------*/ 106 | .m-inline-block { 107 | display: inline-block !important; 108 | } 109 | 110 | /*------container------*/ 111 | 112 | .m-container { 113 | max-width: 72em !important; 114 | margin: auto !important; 115 | } 116 | 117 | .m-container-small { 118 | max-width: 60em !important; 119 | margin: auto !important; 120 | } 121 | 122 | /*------colour------*/ 123 | .m-black { 124 | color: #333 !important; 125 | } 126 | 127 | 128 | /*------media------*/ 129 | 130 | .m-mobile-show { 131 | display: none !important; 132 | } 133 | 134 | @media screen and (max-width: 768px) { 135 | .m-mobile-hide { 136 | display: none !important; 137 | } 138 | .m-mobile-show { 139 | display: block !important; 140 | } 141 | .m-padded-lr-responsive { 142 | padding-left: 0 !important; 143 | padding-right: 0 !important; 144 | } 145 | } 146 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Scihub_ck 8 | 9 | 10 | 19 | 20 | 21 | 22 | 29 |
30 |
31 |
32 |
33 |
34 |
35 |

Tips: .ooo/.nu/.mu/.is/.cool/.shop/.fun are blocked. The unofficial domain sci-hub.gugeeseo.com is opened but does not work well. Recommend: .tw and .se.

36 |
37 |
38 |
39 |

Working Domains

40 |
41 |
42 |

2 43 |

44 |
45 |
46 |
47 | 48 |
49 |
50 |
51 |
52 |

se

53 | 54 |

sci-hub.se

55 |
56 |
57 | 58 |
59 |

0.606 s

60 |
61 |
62 |
63 |
64 |
65 |

tw

66 | 67 |

sci-hub.tw

68 |
69 |
70 | 71 |
72 |

0.940 s

73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 | 81 |
82 |
83 | 84 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /data2index.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | use warnings; 4 | use strict; 5 | 6 | my $num_domain = `wc -l $ARGV[0]`; 7 | $num_domain=~s/(\d+).*$/$1/; 8 | #print $num_domain; 9 | print ' 10 | 11 | 12 | 13 | 14 | 15 | Scihub_ck 16 | 17 | 18 | 27 | 28 | 29 | 30 | 37 |
38 |
39 |
40 |
41 |
42 |
43 |

Tips: .ooo/.nu/.mu/.is/.cool/.shop/.fun are blocked. The unofficial domain sci-hub.gugeeseo.com is opened but does not work well. Recommend: .tw and .se.

44 |
45 |
46 |
47 |

Working Domains

48 |
49 |
50 |

'; 51 | print $num_domain; 52 | print '

53 |
54 |
55 |
56 | 57 |
58 | '; 59 | my $domain; 60 | my $total_time; 61 | open DATA, "<$ARGV[0]"; 62 | #open INDEX, ">$ARGV[1]"; 63 | 64 | while ( ) { 65 | chomp; 66 | ( $domain, $total_time ) = /^(.*?)\t(.*)$/; 67 | # print $domain, $total_time; 68 | print '
69 |
70 |
71 |

'; 72 | print $domain; 73 | print '

74 | 77 |

sci-hub.'; 78 | print $domain; 79 | print '

80 |
81 |
82 | 83 |
84 |

'; 85 | print $total_time; 86 | print ' s

87 |
88 |
89 |
'; 90 | 91 | } 92 | 93 | #close INDEX; 94 | close DATA; 95 | 96 | print '
97 |
98 |
99 |
100 |
101 | 102 |
103 |
104 | 105 | 112 | 113 | 114 | '; 115 | --------------------------------------------------------------------------------