After long-awaited calls, the code to obtain the drawing of "PNAS" is here, but this time I studied for a long time and did not think of how to obtain the drawing of the paid article, so I only downloaded the free article (mainly because I am afraid of infringement), but only the free article It has been three years and there are nearly 1.7w pictures. At the same time, when using code downloads, you still need to surf the Internet scientifically. Therefore, it is recommended that you go directly to the end of the article to download the picture compression package I organized.
Put down the code, and use the command line to run getPNASJPG(YEAR). YEAR is the year of the journal, such as getPNASJPG(2022). If there is a 403 error, it should be fine after a while. . code show as below:
function getPNASJPG(YEAR)
if nargin < 1
YEAR = 2023;
end
YEAR = num2str(YEAR);
str_YEAR = ['d',YEAR(1:3),'0','.y',YEAR];
options = weboptions('Timeout',inf);
url_archive = ['https://www.pnas.org/loi/pnas/group/',str_YEAR];
html_archive = webread(url_archive,options);
A_issue = strfind(html_archive,'past-issue__content__item--all-details d-flex flex-column');
str_issue = html_archive(A_issue(1)+50:A_issue(1)+100);
S1_issue = strfind(str_issue,'|');
S2_issue = strfind(str_issue,'</h2>');
str1_issue = str_issue(S1_issue(1):S1_issue(2));
str2_issue = str_issue(S1_issue(2):S2_issue);
num1_issue = str2num(str1_issue(str1_issue>=48&str1_issue<=57));
num2_issue = str2num(str2_issue(str2_issue>=48&str2_issue<=57));
ibegin = 1; jbegin = 1; kbegin = 1;
forderName=['Year_',num2str(YEAR)];
if exist(['.\image_',forderName,'\ijkbreak.mat'],'file')
load(['.\image_',forderName,'\ijkbreak.mat']);
end
if ~exist(['.\image_',forderName],'dir')
mkdir(['.\image_',forderName]);
end
disp([ibegin,jbegin,kbegin])
for i = ibegin:num2_issue
url_issue = ['https://www.pnas.org/toc/pnas/',num2str(num1_issue),'/',num2str(i)];
html_issue = webread(url_issue,options);
A_article = strfind(html_issue,'Research Article');
Z_article = strfind(html_issue,'Recent Issues');
html_issue = html_issue(A_article(1):Z_article(1));
B_article = strfind(html_issue,'icon-open-access');
A_article = strfind(html_issue,'text-reset animation-underline');
Z_article = strfind(html_issue,'title="');
for j = jbegin:length(B_article)
tA_article = A_article(find(B_article(j)<A_article,1));
url_article = html_issue(tA_article:Z_article(find(Z_article>tA_article,1)));
url_article = url_article(39:end-3);
url_article = ['https://www.pnas.org',url_article];
html_article = webread(url_article,options);
A_JPG = strfind(html_article,[url_article(find(url_article=='/',1,'last'):end),'/asset/']);
Z_JPG = strfind(html_article,'jpg" height=');
for k = kbegin:length(A_JPG)
try
ibegin = i ; jbegin = j; kbegin = k;
save(['.\image_',forderName,'\ijkbreak.mat'],'ibegin','jbegin','kbegin')
url_JPG = ['https://www.pnas.org/cms/10.1073',html_article(A_JPG(k):Z_JPG(k)+2)];
name_JPG = ['.\image_',forderName,'\',url_JPG(find(url_JPG=='/',1,'last')+1:end)];
websave(name_JPG,url_JPG,options);
disp(['Downloading Year-',YEAR,...
' Issue-',num2str(i),' Artical-',num2str(j),...
' Pic-',num2str(k),':',url_article(22:end)])
catch
end
end
kbegin = 1;
end
jbegin = 1;
end
end
The code is set to download with breakpoints, that is, you can download half of the interrupted program and continue downloading after a while.
At the same time, if you sometimes see a picture and want to find the source article to read, the name of the image downloaded by this code will mark the source of the image. For example, you are interested in the picture named pnas.2212633120fig06 below:
Just enter the article link in your browser:
- https://www.pnas.org/doi/10.1073/pnas.2212633120
It is indeed Fig.6, absolutely right!
Partial image display
There is a big difference between good pictures and bad pictures on "PNAS". Everyone has a choice to learn from. Here are some interesting pictures:
2023
2022
2021
image acquisition
Baidu Netdisk
Provide links to the Baidu network disk of pictures in the past three years, a total of about 1.7w pictures:
2023 (2.49G-3209 sheets)
Link:
https://pan.baidu.com/s/1YxRmt53jH-_TXGg6zkqtIg?pwd=slan
Extraction code: slan
2022 (3.12G-3329 photos)
Link:
https://pan.baidu.com/s/1vFcEy48oOklW9UOUShVeAA?pwd=slan
Extraction code: slan
2022 (3.02G-3359 photos)
Link:
https://pan.baidu.com/s/1ItVAmS18DcwlCNsM2u5rwg?pwd=slan
Extraction code: slan
2021 (2.61G-3077 photos)
Link:
https://pan.baidu.com/s/1XHYlxR9_s1Ly9LCtlfnrhQ?pwd=slan
Extraction code: slan
Next 2021 (3.35G-3887 photos)
Link:
https://pan.baidu.com/s/1uCUoi_hUUKlZ3kfc2oI4Yw?pwd=slan
Extraction code: slan
gitee warehouse
If the network disk fails, you can go to the gitee warehouse to get the latest network disk link: