Skip to content

Instantly share code, notes, and snippets.

@prakhar1989
Created July 19, 2015 21:02
Show Gist options
  • Save prakhar1989/374fc42002e6db111594 to your computer and use it in GitHub Desktop.
Save prakhar1989/374fc42002e6db111594 to your computer and use it in GitHub Desktop.
culpa_departments
{
'departments': [
{
'id': '137',
'title': 'Art Hum'
},
{
'id': '303',
'title': 'FoS'
},
{
'id': '2283',
'title': 'Gateway'
},
{
'id': '2721',
'title': 'Music Hum'
},
{
'id': '3379',
'title': 'UW'
},
{
'id': '3545',
'title': 'CC'
},
{
'id': '4601',
'title': 'Lit Hum'
},
{
'id': '3',
'title': 'af-am studies'
},
{
'id': '4',
'title': 'anthropology'
},
{
'id': '63',
'title': 'app physics + math'
},
{
'id': '61',
'title': 'archaeology'
},
{
'id': '45',
'title': 'architecture'
},
{
'id': '41',
'title': 'art history'
},
{
'id': '38',
'title': 'as-am studies'
},
{
'id': '44',
'title': 'astronomy'
},
{
'id': '28',
'title': 'bio + biomed eng'
},
{
'id': '56',
'title': 'business'
},
{
'id': '81',
'title': 'ethnic studies'
},
{
'id': '42',
'title': 'chem + chem eng'
},
{
'id': '53',
'title': 'civil eng'
},
{
'id': '29',
'title': 'classics'
},
{
'id': '7',
'title': 'comp sci'
},
{
'id': '49',
'title': 'dance'
},
{
'id': '106',
'title': 'eee'
},
{
'id': '52',
'title': 'ees'
},
{
'id': '8',
'title': 'ealac'
},
{
'id': '70',
'title': 'eeeb'
},
{
'id': '9',
'title': 'economics'
},
{
'id': '58',
'title': 'education'
},
{
'id': '48',
'title': 'electrical eng'
},
{
'id': '10',
'title': 'english + comp lit'
},
{
'id': '11',
'title': 'film'
},
{
'id': '12',
'title': 'french'
},
{
'id': '30',
'title': 'germanic lang + lit'
},
{
'id': '1',
'title': 'history'
},
{
'id': '68',
'title': 'human rights'
},
{
'id': '57',
'title': 'ieor'
},
{
'id': '13',
'title': 'italian'
},
{
'id': '37',
'title': 'latino studies'
},
{
'id': '71',
'title': 'law'
},
{
'id': '15',
'title': 'math'
},
{
'id': '69',
'title': 'mech eng'
},
{
'id': '43',
'title': 'medicine'
},
{
'id': '16',
'title': 'mesaas'
},
{
'id': '17',
'title': 'music'
},
{
'id': '109',
'title': 'fys'
},
{
'id': '19',
'title': 'philosophy'
},
{
'id': '50',
'title': 'physed'
},
{
'id': '20',
'title': 'physics'
},
{
'id': '21',
'title': 'poli sci'
},
{
'id': '22',
'title': 'psych'
},
{
'id': '23',
'title': 'religion'
},
{
'id': '92',
'title': 'SIPA'
},
{
'id': '46',
'title': 'slavic languages'
},
{
'id': '24',
'title': 'sociology'
},
{
'id': '25',
'title': 'spanish + portu'
},
{
'id': '62',
'title': 'speech'
},
{
'id': '31',
'title': 'statistics'
},
{
'id': '34',
'title': 'swedish'
},
{
'id': '35',
'title': 'theater'
},
{
'id': '66',
'title': 'underwater bw'
},
{
'id': '26',
'title': 'urban studies'
},
{
'id': '27',
'title': 'visual arts'
},
{
'id': '36',
'title': 'women\'s studies'
},
{
'id': '40',
'title': 'writing'
},
{
'id': '110',
'title': 'am studies'
},
{
'id': '111',
'title': 'journalism'
},
{
'id': '112',
'title': 'continuing ed'
},
{
'id': '114',
'title': 'sus dev'
},
{
'id': '115',
'title': 'phys therapy'
}
]
}
@prakhar1989
Copy link
Author

Code to get the above -

var ids = [].slice.call(document.querySelectorAll('div.department-list ul li')).map((x) =>  {
  var node = x.children[0];
  return {
    id: node.href.split('/').slice(-1)[0],
    title: node.text
  }
});
console.log(JSON.stringify({ departments: ids}, null, 2));

Another route that returns both courses and profs for a search query - http://culpa.info/search.json?search=Advanced (unfortunately, CORS not allowed)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment