Bläddra i källkod

Initial GitHub module only retrieving the actual repository

tags/v1.0
JustAnotherArchivist 3 år sedan
förälder
incheckning
6fb0ac4e5e
1 ändrade filer med 21 tillägg och 0 borttagningar
  1. +21
    -0
      codearchiver/modules/github.py

+ 21
- 0
codearchiver/modules/github.py Visa fil

@@ -0,0 +1,21 @@
import codearchiver.core
import codearchiver.modules.git
import datetime
import re


class GitHubModule(codearchiver.core.Module):
name = 'github'

@staticmethod
def matches(inputUrl):
return bool(re.match(r'^https?://(www\.)?github\.com/[^/]+/[^/]+(?<!\.git)$', inputUrl.url))

def process(self):
result = codearchiver.core.Result(id = f'github_{"_".join(self._url.split("/")[3:])}_{datetime.datetime.utcnow():%Y%m%dT%H%M%SZ}')

gitModule = codearchiver.modules.git.Git(codearchiver.core.InputURL(f'{self._url}.git'), id_ = f'{result.id}_git')
gitModuleResult = gitModule.process()
result.submoduleResults.append((gitModule, gitModuleResult))

return result

Laddar…
Avbryt
Spara