Skip to content

Commit

Permalink
Fix some defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
joecorall committed Mar 20, 2024
1 parent ddf742e commit 8d47349
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 4 additions & 1 deletion cmd/arxiv.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ Thank you to arXiv for use of its open access interoperability.`,
if err != nil {
log.Fatal(err)
}
pattern := `/abs/(\d+\.\d+)(?:v\d+)?$`
pattern := `/abs/([0-9a-z]+(\/|\.)\d+)(?:v\d+)?$`
re := regexp.MustCompile(pattern)

for true {
Expand All @@ -126,6 +126,9 @@ Thank you to arXiv for use of its open access interoperability.`,
time.Sleep(3 * time.Second)

matches := re.FindStringSubmatch(e.ID)
if len(matches) <= 1 {
log.Fatal(e.ID)
}
oai := arxiv.GetOaiRecord(matches[1])
if e.JournalRef != "" {
e.JournalRef = fmt.Sprintf(`{"title": "%s"}`, e.JournalRef)
Expand Down
4 changes: 3 additions & 1 deletion pkg/arxiv/oai.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ type OaiAuthor struct {
}

func GetOaiRecord(id string) map[string]string {
values := map[string]string{}
values := map[string]string{
"field_rights": "https://arxiv.org/licenses/nonexclusive-distrib/1.0/license.html",
}
log.Println("Fetching", id)
url := fmt.Sprintf("https://export.arxiv.org/oai2?verb=GetRecord&identifier=oai:arXiv.org:%s&metadataPrefix=arXiv", id)
resp, err := http.Get(url)
Expand Down

0 comments on commit 8d47349

Please sign in to comment.