Bulk gathering of metadata from youtube videos
Hi! I came across a thread that helped me get multiple URLs added to Zotero instead of manually adding them. I only need a .txt with URLs and open the Javascript option in Zotero.
Here's the code I'm talking about:
var path = 'C:\\Users\\Tet\\Documents\\urls.txt';
var urls = Zotero.File.getContents(path).split('\n').map(url => url);
await Zotero.HTTP.processDocuments(
urls,
async function (doc) {
var translate = new Zotero.Translate.Web();
translate.setDocument(doc);
var translators = await translate.getTranslators();
if (translators.length) {
translate.setTranslator(translators[0]);
try {
await translate.translate();
return;
}
catch (e) {}
}
await ZoteroPane.addItemFromDocument(doc);
}
)
However, it is not working for my purposes. One, I don't get to choose where the citations are saved. Second, I get very generic metadata; Since the urls are youtube videos, I want that metadata described when I'm exporting it, instead of calling it a webpage. Is it possible to still get the metadata from the pages I'm extracting metadata, or it's outside the scope of Zotero?
Thanks!
Here's the code I'm talking about:
var path = 'C:\\Users\\Tet\\Documents\\urls.txt';
var urls = Zotero.File.getContents(path).split('\n').map(url => url);
await Zotero.HTTP.processDocuments(
urls,
async function (doc) {
var translate = new Zotero.Translate.Web();
translate.setDocument(doc);
var translators = await translate.getTranslators();
if (translators.length) {
translate.setTranslator(translators[0]);
try {
await translate.translate();
return;
}
catch (e) {}
}
await ZoteroPane.addItemFromDocument(doc);
}
)
However, it is not working for my purposes. One, I don't get to choose where the citations are saved. Second, I get very generic metadata; Since the urls are youtube videos, I want that metadata described when I'm exporting it, instead of calling it a webpage. Is it possible to still get the metadata from the pages I'm extracting metadata, or it's outside the scope of Zotero?
Thanks!
If the URLs also don't work in the browser, there might be something we can do. If they work when using the browser connector but don't work from the bulk script, you're likely out of luck.
They do work with the browser connector, but not when I'm trying to use the code I mentioned. Maybe I'm out of luck indeed.