Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CiS Projekt
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ockenden, Samuel
CiS Projekt
Commits
0325babd
Commit
0325babd
authored
3 years ago
by
Jochens, Florian
Browse files
Options
Downloads
Patches
Plain Diff
implemented get_acrticle_info() and get_download_url()
parent
dbd3e102
No related branches found
Branches containing commit
No related tags found
1 merge request
!1
input
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
input/input_fj.py
+24
-4
24 additions, 4 deletions
input/input_fj.py
with
24 additions
and
4 deletions
input/input_fj.py
+
24
−
4
View file @
0325babd
#!/usr/bin/env python3
#!/usr/bin/env python3
"""
"""
Functions for information retrievel of articles from the ACS journal
Functions for information retrievel of articles from the ACS journal
JCIM
"""
"""
...
@@ -16,6 +16,7 @@ __status__ = "Production"
...
@@ -16,6 +16,7 @@ __status__ = "Production"
from
bs4
import
BeautifulSoup
as
bs
from
bs4
import
BeautifulSoup
as
bs
import
requests
as
req
import
requests
as
req
import
sys
import
sys
from
pathlib
import
Path
class
Publication
:
class
Publication
:
#_registry = []
#_registry = []
...
@@ -53,11 +54,27 @@ def get_article_info():
...
@@ -53,11 +54,27 @@ def get_article_info():
pub
=
Publication
(
article_title
,
publication_date
,
contributors
,
doi_url
)
pub
=
Publication
(
article_title
,
publication_date
,
contributors
,
doi_url
)
return
pub
return
pub
"""
def get_citation_info(pub)
def
get_download_url
():
export
=
soup
.
find
(
'
div
'
,
class_
=
'
cit-download-dropdown_content
'
)
url
=
'
https://pubs.acs.org
'
for
link
in
export
.
find_all
(
'
a
'
):
if
link
.
get
(
'
title
'
)
==
'
Citation and references
'
:
url
+=
link
.
get
(
'
href
'
)
return
url
def
download
(
url
):
# Download citation and references file
if
url
.
find
(
'
=
'
):
filename
=
url
.
rsplit
(
'
=
'
,
1
)[
1
]
path
=
Path
((
'
./files/
'
+
filename
))
if
path
.
is_file
():
print
(
"
File already exists
"
)
else
:
print
(
"
File does not exist
"
)
#def get_citation_info(pub)
return pub
#
return pub
def input():
"""
#
def input():
if
len
(
sys
.
argv
)
!=
2
:
if
len
(
sys
.
argv
)
!=
2
:
sys
.
stderr
.
write
(
'
Usage: {} <url>
\n
'
.
format
(
sys
.
argv
[
0
]))
sys
.
stderr
.
write
(
'
Usage: {} <url>
\n
'
.
format
(
sys
.
argv
[
0
]))
...
@@ -74,3 +91,6 @@ Contributors:''')
...
@@ -74,3 +91,6 @@ Contributors:''')
print
(
*
(
pub
.
contributors
),
sep
=
"
,
"
)
print
(
*
(
pub
.
contributors
),
sep
=
"
,
"
)
print
(
f
'''
print
(
f
'''
DOI-URL:
{
pub
.
doi_url
}
'''
)
DOI-URL:
{
pub
.
doi_url
}
'''
)
url
=
get_download_url
()
download
(
url
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment