raannakasturi commited on
Commit
b90a3da
·
1 Parent(s): 50c7854

Enhance title and citation handling in main.py and post_blog.py with unicode escape decoding and HTML escaping

Browse files
Files changed (2) hide show
  1. main.py +4 -0
  2. post_blog.py +6 -5
main.py CHANGED
@@ -29,6 +29,10 @@ def paper_data(paper_data, wait_time=5):
29
  print(f"Skipping paper with ID: {paper_id} (summary/mindmap not found)")
30
  continue
31
  try:
 
 
 
 
32
  post_blog(title, category, summary, mindmap, citation, access_key, wait_time)
33
  except Exception as e:
34
  print(f"Error posting blog '{title}': {e}")
 
29
  print(f"Skipping paper with ID: {paper_id} (summary/mindmap not found)")
30
  continue
31
  try:
32
+ title = title.encode('unicode-escape').decode().replace('\\\\', '\\')
33
+ summary = summary.encode('unicode-escape').decode().replace('\\\\', '\\')
34
+ mindmap = mindmap.encode('unicode-escape').decode().replace('\\\\', '\\')
35
+ citation = citation.encode('unicode-escape').decode().replace('\\\\', '\\')
36
  post_blog(title, category, summary, mindmap, citation, access_key, wait_time)
37
  except Exception as e:
38
  print(f"Error posting blog '{title}': {e}")
post_blog.py CHANGED
@@ -1,4 +1,5 @@
1
  import os
 
2
  import time
3
  import requests
4
  import dotenv
@@ -149,7 +150,7 @@ def test(uaccess_key):
149
  "2412.16344": {
150
  "id": "2412.16344",
151
  "doi": "https://doi.org/10.48550/arXiv.2412.16344",
152
- "title": "Gravitational algebras and applications to nonequilibrium physics",
153
  "category": "Astrophysics",
154
  "citation": "Grant, C. E., Bautz, M. W., Miller, E. D., Foster, R. F., LaMarr, B., Malonis, A., Prigozhin, G., Schneider, B., Leitz, C., & Falcone, A. D. (2024). Focal Plane of the Arcus Probe X-Ray Spectrograph. ArXiv. https://doi.org/10.48550/ARXIV.2412.16344",
155
  "summary": "## Summary\nThe text discusses gravitational algebras and their applications in nonequilibrium physics, specifically in the context of black holes and de Sitter spacetime. It explores the concept of type III and type II von Neumann algebras and their role in understanding the thermodynamic properties of gravitational systems.\n\n## Highlights\n- The Arcus Probe mission concept explores the formation and evolution of clusters, galaxies, and stars.\n- The XRS instrument includes four parallel optical channels and two detector focal plane arrays.\n- The CCDs are designed and manufactured by MIT Lincoln Laboratory (MIT/LL).\n- The XRS focal plane utilizes high heritage MIT/LL CCDs with proven technologies.\n- Laboratory testing confirms CCID-94 performance meets required spectral resolution and readout noise.\n- The Arcus mission includes two co-aligned instruments working simultaneously.\n- The XRS Instrument Control Unit (XICU) controls the activities of the XRS.\n\n## Key Insights\n- The Arcus Probe mission concept provides a significant improvement in sensitivity and resolution over previous missions, enabling breakthrough science in understanding the universe.\n- The XRS instrument's design, including the use of two CCD focal planes and four parallel optical channels, allows for high-resolution spectroscopy and efficient detection of X-ray photons.\n- The CCDs used in the XRS instrument are designed and manufactured by MIT Lincoln Laboratory (MIT/LL), which has a proven track record of producing high-quality CCDs for space missions.\n- The laboratory performance results of the CCID-94 device demonstrate that it meets the required spectral resolution and readout noise for the Arcus mission, indicating that the instrument is capable of achieving its scientific goals.\n- The XRS Instrument Control Unit (XICU) plays a crucial role in controlling the activities of the XRS, including gathering and storing data, and processing event recognition.\n- The Arcus mission's use of two co-aligned instruments working simultaneously allows for a wide range of scientific investigations, including the study of time-domain science and the physics of time-dependent phenomena.\n- The high heritage MIT/LL CCDs used in the XRS focal plane provide a reliable and efficient means of detecting X-ray photons, enabling the instrument to achieve its scientific goals.",
@@ -163,11 +164,11 @@ def test(uaccess_key):
163
  for category, catdata in data.items():
164
  if category != 'status':
165
  for paper_id, paperdata in catdata.items():
166
- title = paperdata['title']
167
  category = paperdata['category']
168
- summary = paperdata['summary']
169
- mindmap = paperdata['mindmap']
170
- citation = paperdata['citation']
171
  uaccess_key = access_key
172
  status = post_blog(title, category, summary, mindmap, citation, uaccess_key, 0)
173
  print(status)
 
1
  import os
2
+ import html
3
  import time
4
  import requests
5
  import dotenv
 
150
  "2412.16344": {
151
  "id": "2412.16344",
152
  "doi": "https://doi.org/10.48550/arXiv.2412.16344",
153
+ "title": "Demographics of black holes at <$100 R$_{\rm g}$ scales: accretion flows, jets, and shadows",
154
  "category": "Astrophysics",
155
  "citation": "Grant, C. E., Bautz, M. W., Miller, E. D., Foster, R. F., LaMarr, B., Malonis, A., Prigozhin, G., Schneider, B., Leitz, C., &amp; Falcone, A. D. (2024). Focal Plane of the Arcus Probe X-Ray Spectrograph. ArXiv. https://doi.org/10.48550/ARXIV.2412.16344",
156
  "summary": "## Summary\nThe text discusses gravitational algebras and their applications in nonequilibrium physics, specifically in the context of black holes and de Sitter spacetime. It explores the concept of type III and type II von Neumann algebras and their role in understanding the thermodynamic properties of gravitational systems.\n\n## Highlights\n- The Arcus Probe mission concept explores the formation and evolution of clusters, galaxies, and stars.\n- The XRS instrument includes four parallel optical channels and two detector focal plane arrays.\n- The CCDs are designed and manufactured by MIT Lincoln Laboratory (MIT/LL).\n- The XRS focal plane utilizes high heritage MIT/LL CCDs with proven technologies.\n- Laboratory testing confirms CCID-94 performance meets required spectral resolution and readout noise.\n- The Arcus mission includes two co-aligned instruments working simultaneously.\n- The XRS Instrument Control Unit (XICU) controls the activities of the XRS.\n\n## Key Insights\n- The Arcus Probe mission concept provides a significant improvement in sensitivity and resolution over previous missions, enabling breakthrough science in understanding the universe.\n- The XRS instrument's design, including the use of two CCD focal planes and four parallel optical channels, allows for high-resolution spectroscopy and efficient detection of X-ray photons.\n- The CCDs used in the XRS instrument are designed and manufactured by MIT Lincoln Laboratory (MIT/LL), which has a proven track record of producing high-quality CCDs for space missions.\n- The laboratory performance results of the CCID-94 device demonstrate that it meets the required spectral resolution and readout noise for the Arcus mission, indicating that the instrument is capable of achieving its scientific goals.\n- The XRS Instrument Control Unit (XICU) plays a crucial role in controlling the activities of the XRS, including gathering and storing data, and processing event recognition.\n- The Arcus mission's use of two co-aligned instruments working simultaneously allows for a wide range of scientific investigations, including the study of time-domain science and the physics of time-dependent phenomena.\n- The high heritage MIT/LL CCDs used in the XRS focal plane provide a reliable and efficient means of detecting X-ray photons, enabling the instrument to achieve its scientific goals.",
 
164
  for category, catdata in data.items():
165
  if category != 'status':
166
  for paper_id, paperdata in catdata.items():
167
+ title = html.escape(paperdata['title'].encode('unicode-escape').decode().replace('\\\\', '\\'))
168
  category = paperdata['category']
169
+ summary = paperdata.get('summary', '')
170
+ mindmap = paperdata.get('mindmap', '')
171
+ citation = paperdata.get('citation', '')
172
  uaccess_key = access_key
173
  status = post_blog(title, category, summary, mindmap, citation, uaccess_key, 0)
174
  print(status)