Skip to content

Commit

Permalink
Finally add csv output to scraper
Browse files Browse the repository at this point in the history
  • Loading branch information
JOJ0 committed Aug 6, 2024
1 parent 9ad9bee commit 5aa70ab
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions scrape_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,20 @@ def scrape(output, url):
link = e['href']
if output == 'default':
print(f'{e.text} {link}')
if output == 'rst':
if output in ['rst', 'csv']:
parts = chapter.split('admin_api')
fulllink = f'{parts[0]}admin_api{parts[1]}{link}'
print(f'`{e.text} <{fulllink}>`')
if output == 'rst':
rst = f'`{e.text} <{fulllink}>`'
print(rst)
# csv format also adds some spacing in front of links
if output == 'csv':
left_col = f' `{e.text} <{fulllink}>`'
print(f'{left_col},')
# Final spacing only with these formats
if output in ['default', 'rst']:
print()

print()
print()
print()
#print(soup.prettify())


Expand Down

0 comments on commit 5aa70ab

Please sign in to comment.