Last active
February 22, 2020 14:27
-
-
Save kschlottmann/d4bee3b08a731fdfbb1a9367ea5ed86f to your computer and use it in GitHub Desktop.
From a list of ids, pull down marcxml records from CLIO
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import requests, csv, json, urllib, time | |
| baseURL = 'https://clio.columbia.edu/catalog/' | |
| endURL = '.marcxml' | |
| with open('inputlist.csv', 'r') as csvfile: | |
| reader = csv.reader(csvfile, delimiter='|', quotechar='"') | |
| for row in reader: | |
| bib = str(row[0]) | |
| url = baseURL+bib+endURL | |
| response = requests.get(url) | |
| print(response.content) | |
| time.sleep(15) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="UTF-8"?> | |
| <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
| xmlns:xs="http://www.w3.org/2001/XMLSchema" | |
| exclude-result-prefixes="xs" | |
| version="2.0"> | |
| <xsl:output omit-xml-declaration="yes"/> | |
| <xsl:template match="/all"> | |
| <xsl:for-each select="record/datafield[@tag='852']"> | |
| <xsl:value-of select="normalize-space(../controlfield[@tag='001'])"/> | |
| <xsl:text>|</xsl:text> | |
| <xsl:value-of select="normalize-space(subfield[@code='a'])"/> | |
| <xsl:text>|</xsl:text> | |
| <xsl:value-of select="normalize-space(subfield[@code='b'])"/> | |
| <xsl:text>|</xsl:text> | |
| <xsl:value-of select="normalize-space(subfield[@code='h'])"/> | |
| <xsl:text>
</xsl:text> | |
| </xsl:for-each> | |
| </xsl:template> | |
| </xsl:stylesheet> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="UTF-8"?> | |
| <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
| xmlns:xs="http://www.w3.org/2001/XMLSchema" | |
| exclude-result-prefixes="xs" | |
| version="2.0"> | |
| <xsl:output omit-xml-declaration="yes"/> | |
| <xsl:template match="/all"> | |
| <xsl:for-each select="record/datafield[@tag='035'][contains(., 'LC)on')]"> | |
| <xsl:value-of select="normalize-space(../controlfield[@tag='001'])"/> | |
| <xsl:text>|</xsl:text> | |
| <xsl:value-of select="normalize-space(../datafield[@tag='040']/subfield[@code='a'])"/> | |
| <xsl:text>|</xsl:text> | |
| <xsl:value-of select="normalize-space(subfield[@code='a'])"/> | |
| <xsl:text>|</xsl:text> | |
| <xsl:value-of select="normalize-space(subfield[@code='a'])"/> | |
| <xsl:text>
</xsl:text> | |
| </xsl:for-each> | |
| </xsl:template> | |
| </xsl:stylesheet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment