Get the raw URL for a GitHub file. Args: url (str): The GitHub URL. Returns: str: The raw URL.
(url)
| 75 | |
| 76 | |
| 77 | def github_raw_url(url): |
| 78 | """Get the raw URL for a GitHub file. |
| 79 | |
| 80 | Args: |
| 81 | url (str): The GitHub URL. |
| 82 | Returns: |
| 83 | str: The raw URL. |
| 84 | """ |
| 85 | if isinstance(url, str) and url.startswith("https://github.com/") and "blob" in url: |
| 86 | url = url.replace("github.com", "raw.githubusercontent.com").replace( |
| 87 | "blob/", "" |
| 88 | ) |
| 89 | return url |
| 90 | |
| 91 | |
| 92 | def download_file( |