Created
August 29, 2020 09:48
-
-
Save zzilch/a7698ab44f8fc81e93359056a6543aac to your computer and use it in GitHub Desktop.
Siggraph 2020 Technical Paper Robot
This file contains 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
// https://s2020.siggraph.org/conference/program-events/technical-papers/ | |
host = window.location.host | |
sessions = [] | |
sRows = jQuery('.presentation-row') | |
sRows.each(function(idx,row){ | |
areas = [] | |
keywords = [] | |
jRow = jQuery(row) | |
jRow.find('.interest-area .program-track').each((i,k)=>areas.push(k.textContent)) | |
jRow.find('.keyword .program-track').each((i,k)=>keywords.push(k.textContent)) | |
sessions.push({ | |
'psid':jRow.attr('psid'), | |
//'ptracks':jRow.attr('ptracks').split(' '), | |
'time':jRow.find('.presentation-time').text(), | |
'title':jRow.find('.presentation-title').text(), | |
'areas':areas, | |
'keywords':keywords | |
}) | |
}) | |
sessions = sessions.slice(0,-2) | |
n_paper = 0 | |
for(i=0;i<sessions.length;i++){ | |
sess = sessions[i] | |
sess_id = sess['psid'] | |
papers = [] | |
pRows = jQuery(`.${sess_id} .agenda-item`) | |
pRows.each(function(idx,row){ | |
authors = [] | |
jRow = jQuery(row) | |
jRow.find('.presenter-name').each((i,k)=>authors.push(k.textContent)) | |
eImg = row.children[0].children[0] | |
eTitle = row.children[1].children[0] | |
papers.push({ | |
'ssid':jRow.attr('ssid'), | |
'img':eImg.src, | |
'url':eTitle.href, | |
'title':eTitle.textContent, | |
//'author':authors | |
}) | |
n_paper+=1 | |
}) | |
sessions[i]['papers']=papers | |
} | |
finished = 0 | |
for(let i=0;i<sessions.length;i++){ | |
for(let j=0;j<sessions[i]['papers'].length;j++){ | |
paper = sessions[i]['papers'][j] | |
url = paper['url'] | |
jQuery.get({ | |
"url": url, | |
"success": function(data) { | |
jData = jQuery(data) | |
abstract = jData.find('.abstract').text() | |
authors = [] | |
jData.find('.pic-auth-container').each(function(idx,auth){ | |
name = auth.children[0].textContent | |
institutions = [] | |
insts = auth.children[1].children | |
for(let k=0;k<insts.length;k++){ | |
institutions.push(insts[k].textContent) | |
} | |
authors.push({ | |
'name':name, | |
'institutions':institutions | |
}) | |
}) | |
sessions[i]['papers'][j]['abstract']=abstract | |
sessions[i]['papers'][j]['authors']=authors | |
finished+=1 | |
console.log(`${finished}/${n_paper}`) | |
}, | |
"error": function(jqr, e1, e2) {console.log(e1 + ' ' + e2)} | |
}) | |
} | |
} | |
// http://programandconquer.com/save-console-browser-json-file/ | |
(function(console){ | |
console.save = function(data, filename){ | |
if(!data) { | |
console.error('Console.save: No data') | |
return; | |
} | |
if(!filename) filename = 'console.json' | |
if(typeof data === "object"){ | |
data = JSON.stringify(data, undefined, 4) | |
} | |
var blob = new Blob([data], {type: 'text/json'}), | |
e = document.createEvent('MouseEvents'), | |
a = document.createElement('a') | |
a.download = filename | |
a.href = window.URL.createObjectURL(blob) | |
a.dataset.downloadurl = ['text/json', a.download, a.href].join(':') | |
e.initMouseEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null) | |
a.dispatchEvent(e) | |
} | |
})(console) | |
console.save(sessions,'technical-paper.json') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment