FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
scripts/non_PMC_emails.py at master · Dinara/scripts · GitHub
Dinara
scripts
Repository navigation
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
scripts
/
non_PMC_emails.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
29 lines (20 loc) · 841 Bytes
Breadcrumbs
scripts
/
non_PMC_emails.py
Copy path
File metadata and controls
29 lines (20 loc) · 841 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import
requests
from
bs4
import
BeautifulSoup
f
=
open
(
'pmid.txt'
,
'r'
)
PMIDs
=
[
line
.
rstrip
()
for
line
in
f
if
len
(
line
.
rstrip
())
is
not
0
]
f
.
close
()
full_links
=
[]
for
pmid
in
PMIDs
:
url
=
"http://www.ncbi.nlm.nih.gov/pubmed/?term="
+
pmid
# Sends a GET request. Returns Response object
r
=
requests
.
get
(
url
)
# r.content -- in bytes
data
=
BeautifulSoup
(
r
.
content
)
# find the link to the full article
data_link
=
data
.
find_all
(
"a"
,
title
=
"Full text at publisher's site"
)
for
link
in
data_link
:
full_text_link
=
link
.
get
(
"href"
)
r2
=
requests
.
get
(
full_text_link
)
data2
=
BeautifulSoup
(
r2
.
text
)
for
email
in
data2
.
find_all
(
"a"
,
attrs
=
{
"title"
:
"Link to email address"
}):
print
'pmid: '
,
pmid
,
"email: "
,
email
.
text
Back
|
FazBrowse Home
|
New Git URL