It is currently Mon Sep 25, 2023 11:08 pm
Black_Stormy wrote:So I'm in Argentina now. Woop Woop!
Dives wrote:I got hired by Monochrome LLC to work on Contagion.
Dives wrote:I got hired by Monochrome LLC to work on Contagion.
Armageddon wrote:Dives wrote:I got hired by Monochrome LLC to work on Contagion.
Congrats man!Get one of the mods to change your forum tag.
Ennui wrote:I've been working as a professional front-end web developer (and dabbling in back end) and UI/UX designer for the past 2 years since I graduated university.
function () {
/////////////
// General //
/////////////
var scraper = {};
scraper.name = "GameJolt.com";
scraper.host = "http://www.gamejolt.com/";
scraper.category = "games";
scraper.description = "Like good indie games? Maybe you like bad indie games? Well GameJolt has tons of both!";
scraper.buttonURL = "asset://smarcade/scrapers/GameJolt.tbn";
scraper.matchMsg = "Hazzuh! Spawn this game in your arcade?";
scraper.confirmMsg = "Yes, spawn it now!";
scraper.async = false;
scraper.author = "SM Sith Lord";
scraper.version = "1.0";
scraper.data = {};
////////////////////////
// Define Check Logic //
////////////////////////
scraper.checkLogic = function(scraper) {
var url = window.location.href;
var found = url.indexOf("gamejolt.com/games/");
if( found >= 0 ) {
var buf = url.substring(found+19);
found = buf.indexOf("/");
if( found > 0 ) {
buf = buf.substring(found+1);
found = buf.indexOf("/");
if( found > 0 ) {
buf = buf.substring(found+1);
found = buf.indexOf("/");
if( found > 0 ) {
return true;
}
}
}
}
return false;
};
/////////////////////////
// Define Scrape Logic //
/////////////////////////
scraper.scrapeLogic = function(scraper) {
var profileBaseURL = "http://www.gamejolt.com/";
var screenshotBaseURL = "http://i.gjcdn.net/imgserver/screenshot-thumbnail/1280x720/";
var marqueeBaseURL = "http://i.gjcdn.net/imgserver/game-header/original/";
var videoBaseURL = "http://www.gamejolt.com/vidserver/view/1280x720/";
var videoCapURL = "/?autoplay=1";
// TITLE
var title = scraper.findTagWithAttributeValue(document, "meta", "property", "og:title");
title = title.getAttribute("content");
scraper.data["title"] = title;
// PROFILE_URL
var profile_url = scraper.findTagWithAttributeValue(document, "meta", "property", "og:url");
profile_url = profile_url.getAttribute("content");
profile_url = profileBaseURL + profile_url.substring(profile_url.indexOf("games/"));
scraper.data["profile_url"] = profile_url;
// SCREENSHOT_URL
var screenshot_url = scraper.findTagWithAttributeValue(document, "img", "alt", "Screenshot");
if( screenshot_url) {
screenshot_url = screenshotBaseURL + screenshot_url.src.substring(screenshot_url.src.lastIndexOf("/")+1);
scraper.data["screenshot_url"] = screenshot_url;
}
// MARQUEE_URL
var elem = scraper.findTagWithAttributeValue(document, "div", "class", "game-title");
if( elem ) {
elem = elem.parentNode;
elem = scraper.findTagWithAttributeValue(elem, "img", "alt", title);
if( elem ) {
var marquee_url = marqueeBaseURL + elem.src.substring(elem.src.lastIndexOf("/")+1);
scraper.data["marquee_url"] = marquee_url;
}
}
// MARQUEE_URL (if still needed)
if( scraper.data["marquee_url"] == "" ) {
var marquee_url = scraper.findTagWithAttributeValue(document, "meta", "property", "og:image");
marquee_url = marquee_url.getAttribute("content");
scraper.data["marquee_url"] = marquee_url;
}
// PREVIEW_URL
var preview_url = scraper.findTagWithAttributeValue(document, "img", "alt", "Video");
if( preview_url ) {
preview_url = preview_url.src.substring(preview_url.src.lastIndexOf("/")+1);
preview_url = preview_url.substring(0, preview_url.lastIndexOf("."))
preview_url = videoBaseURL + preview_url + videoCapURL;
scraper.data["preview_url"] = preview_url;
}
// DESCRIPTION
elem = scraper.findTagWithContents(document, "div", "Show Less");
var description = elem.parentNode.innerText.trim();
scraper.data["description"] = description;
// FILE_LOCATION
// If this is a browser game, then the FILE_LOCATION is the PROFILE_URL.
// Otherwise, the FILE_LOCATION is the TITLE.
if( document.getElementById("online-game-container") ) {
scraper.data["file_location"] = profile_url;
}
else {
scraper.data["file_location"] = title;
}
// TYPE
scraper.data["type"] = "pc";
// DOWNLOAD_URL
// For cross-platform support, just point to the profile page itself.
scraper.data["download_url"] = profile_url;
// REPLACE DEFAULT SCREEN AND MARQUEE IMAGE IF EMPTY
if( typeof scraper.data["screenshot_url"] != "string" ) {
scraper.data["screenshot_url"] = "http://www.smarcade.net/dlcv2/gamejolt_screen.png";
}
else if( typeof scraper.data["marquee_url"] != "string" ) {
scraper.data["marquee_url"] = "http://www.smarcade.net/dlcv2/gamejolt_marquee.jpg";
}
return true;
};
////////////////////////////////////
// Define Custom Helper Functions //
////////////////////////////////////
scraper.findTagWithAttributeValue = function(base, tag, attribute, value) {
var elements = base.getElementsByTagName(tag);
for( var i = 0; i < elements.length; i++ ) {
if( elements[i].hasAttribute(attribute) && elements[i].getAttribute(attribute) == value ) {
return elements[i];
}
}
return false;
};
scraper.findTagWithContents = function(base, tag, contents) {
var elements = base.getElementsByTagName(tag);
for( var i = 0; i < elements.length; i++ ) {
if( elements[i].innerHTML == contents ) {
return elements[i];
}
}
return false;
};
////////////////////////
// Return the scraper //
////////////////////////
return scraper;
};
Users browsing this forum: No registered users