https://github.com/suqingdong/pubmed_xml
PubMed XML Parser
https://github.com/suqingdong/pubmed_xml
pubmed pubmed-parser pubmed-xml
Last synced: 5 months ago
JSON representation
PubMed XML Parser
- Host: GitHub
- URL: https://github.com/suqingdong/pubmed_xml
- Owner: suqingdong
- Created: 2022-11-29T06:13:52.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2025-01-10T02:52:04.000Z (over 1 year ago)
- Last Synced: 2025-08-28T07:31:54.852Z (9 months ago)
- Topics: pubmed, pubmed-parser, pubmed-xml
- Language: Python
- Homepage: https://suqingdong.github.io/pubmed_xml/
- Size: 18.6 KB
- Stars: 4
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# PubMed XML Parser
## Installation
```bash
python3 -m pip install pubmed_xml
```
## Usage
### CommandLine
```bash
pubmed_xml --help
# parse single
pubmed_xml 30003000
# parse batch
pubmed_xml 30003000,30003001,30003002
# parse multiple
pubmed_xml 30003000 30003001 30003002
# parse from xml file
pubmed_xml tests/pubmed22n1543.xml.gz -o out.jl
# save file
pubmed_xml 30003000,30003001,30003002 -o out.jl
```
### Python
```python
from pubmed_xml import Pubmed_XML_Parser
pubmed = Pubmed_XML_Parser()
for article in pubmed.parse('30003000,30003001,30003002'):
print(article) # Article<30003002>
print(article.data) # dict object
print(article.to_json(indent=2)) # json string
print(article.pmid, article.title, article.abstract) # by attribute
print(article['pmid'], article['title'], article['abstract']) # by key
```