Skip to content

Commit

Permalink
add scripts/readme_crawler.py
Browse files Browse the repository at this point in the history
  • Loading branch information
LifeAdventurer committed Oct 11, 2024
1 parent 1233917 commit f73755f
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ dev/
site/

.vscode/

temp_readme.md
27 changes: 27 additions & 0 deletions scripts/readme_crawler.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import requests


def get_readme(username, repository):
url = f"https://raw.githubusercontent.com/{username}/{repository}/master/README.md"
response = requests.get(url)
if response.status_code == 200:
return response.text
else:
return None


def main():
username = input("Enter GitHub username: ")
repository = input("Enter repository name: ")
readme_content = get_readme(username, repository)
if readme_content:
print("README successfully fetched.")
with open("./temp_readme.md", "w", encoding="utf-8") as f:
f.write(readme_content)
print("README saved successfully.")
else:
print("Failed to fetch README.")


if __name__ == "__main__":
main()

0 comments on commit f73755f

Please sign in to comment.