{"id":37041991,"url":"https://github.com/loglob/olspy","last_synced_at":"2026-01-14T04:57:30.974Z","repository":{"id":143637350,"uuid":"501336059","full_name":"loglob/olspy","owner":"loglob","description":"A library that allows basic read-only API access to an overleaf instance ","archived":false,"fork":false,"pushed_at":"2025-04-16T14:26:39.000Z","size":116,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"v2","last_synced_at":"2025-10-19T18:55:40.373Z","etag":null,"topics":["csharp","overleaf"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/loglob.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2022-06-08T16:49:28.000Z","updated_at":"2025-04-16T14:26:44.000Z","dependencies_parsed_at":"2024-04-17T14:42:20.510Z","dependency_job_id":null,"html_url":"https://github.com/loglob/olspy","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/loglob/olspy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loglob%2Folspy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loglob%2Folspy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loglob%2Folspy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loglob%2Folspy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/loglob","download_url":"https://codeload.github.com/loglob/olspy/tar.gz/refs/heads/v2","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loglob%2Folspy/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28409970,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T01:52:23.358Z","status":"online","status_checked_at":"2026-01-14T02:00:06.678Z","response_time":107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["csharp","overleaf"],"created_at":"2026-01-14T04:57:30.507Z","updated_at":"2026-01-14T04:57:30.965Z","avatar_url":"https://github.com/loglob.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Olspy\nA basic read-only API for Overleaf\n\n## What it can do\n- Connect to any Overleaf instance that is accessible through the browser\n- Read a project's file structure\n- Read the contents of documents\n- Request compilations\n- Read edit history\n\n## What is can't do\n- List a user's projects\n- Make edits in a document\n- Observe real-time edits to a document\n\n## Installation\nThe package is available via [nuget](https://www.nuget.org/packages/olspy), so you can add it to your project with\n```\ndotnet add package olspy\n```\n\n## Usage\nFirst, open a project using one of the overloads of `Olspy.Project.Open()`:\n```cs\n// join via a normal share link\nvar project = await Olspy.Project.Open(new Uri(\"https://my-overleaf-instance.com/SHARE-URL-HERE\u003e\"));\n// join via project ID and session token\nvar project = await Olspy.Project.Open(new Uri(\"https://my-overleaf-instance.com/base-url\"), \"PROJECT ID HERE\", \"SESSION TOKEN COOKIE HERE\");\n// join via project ID and user credentials\nvar project = await Olspy.Project.Open(new Uri(\"https://my-overleaf-instance.com/base-url\"), \"PROJECT ID HERE\", \"YOUR@EMAIL.HERE\", \"YOUR PASSWORD HERE\");\n```\n\n### Project Information and File Structure\nTo get project information such as its name, the file structure and the contents of documents, either open a project session like this:\n```cs\nasync using(var session = await project.Join())\n{\n\t// contains general project info, including its file tree\n\tvar info = await session.GetProjectInfo();\n\t// info.project holds miscellaneous project information\n\tvar mainFile = info.project.RootDocID;\n\t// gets the lines of an editable document\n\tvar lines = await session.GetDocumentByID(mainFile);\n}\n```\nOr use equivalent methods on `project` that open temporary sessions automatically:\n```cs\nvar info = await project.GetProjectInfo();\n// info.project holds miscellaneous project information \nvar mainFile = info.project.RootDocID;\n// gets the lines of an editable document\nvar lines = await project.GetDocumentByID(mainFile);\n```\n\n### Compiling\nTo compile a document, use the `Project.Compile()` method like this\n```cs\n// you can also specify different main files, draft mode, etc.\nvar compilation = await project.Compile();\n```\nThe return value specifies the created files:\n```cs\n// First, find an output file ID\nvar aux = compilation.OutputFiles.First(f =\u003e f.Path.EndsWith(\".aux\"));\n// Then retrieve it via the project\nvar auxContent = await project.GetOutFile(aux);\n// GetOutFile() returns a HttpContent\nvar auxString = await auxContent.ReadAsStringAsync();\n```\nTo check for success (defined as producing a PDF, even if there may have been non-fatal compile errors) use `IsSuccess()`:\n```cs\nif(compilation.IsSuccess(out var pdf))\n{\n\t// pdf is the produced PDF file\n\tvar pdfContent = await project.GetOutFile(pdf);\n\n\tusing(var f = File.Create(\"compiled.pdf\"))\n\t\tawait pdfContent.CopyToAsync(f);\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Floglob%2Folspy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Floglob%2Folspy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Floglob%2Folspy/lists"}