d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Make Me A Better Programmer - From Step 2
Prev12345610Next
Add Reply New Topic New Poll
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Nov 27 2014 08:24am
i'm contemplating writing a script giving myself an orb and name change that only i can see, lol.

on a weird note, tampermonkey seems to be interfering with audible's website. weird. when im looking through their sales, i can't filter by genre until i disable tampermonkey. it's not related to my scripts since they only affect forums.d2jsp.org/topic.php*, so it must be the extension itself.
Member
Posts: 23,862
Joined: Aug 16 2006
Gold: 20.00
Nov 27 2014 02:58pm
Quote (carteblanche @ Nov 27 2014 09:24am)
i'm contemplating writing a script giving myself an orb and name change that only i can see, lol.

on a weird note, tampermonkey seems to be interfering with audible's website. weird. when im looking through their sales, i can't filter by genre until i disable tampermonkey. it's not related to my scripts since they only affect forums.d2jsp.org/topic.php*, so it must be the extension itself.


That is weird....reminds me of when we were using a 3rd party library for GoAsm in my x86 class to simplify some things (mostly reading/writing to/from terminal, etc)

Me and some friends got weird problems when we created various functions, such as pow and fact(factorial)

at run time, it was jumping to random ass code in the library! Apparently, the guy who wrote the library, didn't put much effort into naming his functions something that would avoid collision!

Just changing the name of our labels fixed the problem....but it was a bitch to debug, because I spent the entire time thinking my code went wrong, and it wasn't until I checked GoDebug that I found it was jumping to some shit I never wrote!
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Jan 9 2015 10:26pm
New side project. i'm getting really irritated by audible's lack of search features. they have sales like half off everything, but there's no way for me to search for books < 10$ with length > 6h and # reviews > 500 and rating > 3 of 5 order by rating desc. i want to buy books from them, but they make it so difficult for me to find them.

i'm thinking about scraping the site and storing the data myself so i can customize the search. i need to decide what tools to use. i might not use the best tools for the job, but rather a tool i'd like to learn anyway. perhaps something like an offline jquery / nodejs. perhaps have a list of urls that list the books, then parse the data and store into a database or excel sheet.

This post was edited by carteblanche on Jan 9 2015 10:27pm
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Jan 16 2015 09:58pm
i'm scraping sales first so i can see them at a glance to make my life easier. url: http://www.audible.com/sp/3for2/

basically it shows a list of books (image, title, author) but doesnt tell me the ratings / narrator until i hover over it. so i'm scraping that info and storing in local storage as json, as well as adding the narrator / ratings in color

Code
// ==UserScript==
// @name Audile Sales Scrape
// @namespace http://your.homepage/
// @version 0.1
// @description Lists all the books on an audible sale
// @author carteblanche
// @match http://www.audible.com/sp*
// @grant none
// @require http://code.jquery.com/jquery-latest.js
// ==/UserScript==

$(document).ready(function() {
var books = [];
// metadata container; i think this is everything i want
$(".adbl-sp-prod-meta-data-content").each(function(){
// console.log("found metadata container");

var title = $(this).children(".adbl-sp-prod-title").eq(0).html();
var author = $(this).children(".adbl-sp-prod-author").eq(0).html();
// there are three ratings, but i only want the first one
var ratings = $(this).find(".adbl-rating-num").eq(0).html();
// there are two strong; first is author, second is narrator. i only want the second
var narrators = $(this).find("strong").last().eq(0).html();

var book = {
title: title,
author: author,
ratings: ratings,
narrators: narrators
};
books.push(book);

// change author element to include narrator / ratings:
$(this).children(".adbl-sp-prod-author").eq(0).html(
'A: ' + author + '<br/>' +
'<span style="color:blue">N: ' + narrators + '</span><br/>' +
'<span style="color:green">#R: ' + ratings + '</span>'
);
});
localStorage['audibleSales'] = JSON.stringify(books);
console.log(JSON.stringify(books));

});


then a simple shell script to take the data from the local storage of the browser into a .json file

Code
sqlite3 "/home/jiggles/.config/chromium/Default/Local Storage/http_www.audible.com_0.localstorage" 'select cast(value as text) from itemtable' > /jiggles/temp/audible/books.json


thinking about it now, though, i dont really need sales info separate on my hard drive. maybe i'll build a page that shows me a friendly list instead of audible's bloated page with icons and sorted the way i want.

Before:


After: (narrators in blue, # ratings in green)


This post was edited by carteblanche on Jan 16 2015 10:27pm
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Jan 16 2015 10:28pm
wanted to move the images above the code so you can see what it's doing better, but too late now lol.
Member
Posts: 23,862
Joined: Aug 16 2006
Gold: 20.00
Jan 16 2015 10:47pm
Quote (carteblanche @ Jan 16 2015 11:28pm)
wanted to move the images above the code so you can see what it's doing better, but too late now lol.


neat little script you got there!

I need to find a small something to work on with JS/HTML5 ....

Our entire software client/front end shit at work is done in Silverlight, and we want to switch over to those two....I imagine I will be somewhat vested in that stuff in the near future, even though my team is responsible for mostly back end functionality for some things.

This post was edited by Eep on Jan 16 2015 10:47pm
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Jan 17 2015 12:38am
painful so far trying to get nodejs and jquery working together. jsdom isnt installing nicely. will google more another day i think.

/for my reference: http://stackoverflow.com/questions/23053425/npm-install-module-persistent-error-node-gyp-build

This post was edited by carteblanche on Jan 17 2015 12:38am
Member
Posts: 1,995
Joined: Jun 28 2006
Gold: 7.41
Jan 22 2015 07:58am
Remember that dude asking how to fix his lag issues with his d2 game? And you started trolling him saying it was an ArrayOutOfBoundException? And then I started trolling him saying I would fix it for 1 more fg than he had? Well, apparently that was an "Illegal Trade" and someone suspended me. Must not have been a very long one since I am posting here after 8 hours, but still...this board has some retarded moderators.

This post was edited by Minkomonster on Jan 22 2015 07:58am
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Jan 22 2015 03:14pm
keep going and you'll get a year long ban. is abduct still banned for some reason or another? i've gotten several "24 hour bans" but able to login right after. it's weird. usually it's right after i send a pm or make a post, so i assumed i hit some ban-word filter, but when i pm a mod they tell me either the filter doesnt exist or i should stay away from illegal topics and i'll be fine. nobody ever told me why i get the ban or what word tripped the filter.

ps i admit to no alleged trolling.

This post was edited by carteblanche on Jan 22 2015 03:38pm
Member
Posts: 1,995
Joined: Jun 28 2006
Gold: 7.41
Jan 22 2015 03:30pm
Quote (carteblanche @ Jan 22 2015 04:14pm)
keep going and you'll get a year long ban. is abduct still banned for some reason or another? i've gotten several "24 hour bans" but able to login right after. it's weird. usually it's right after i send a pm or make a post, so i assumed i hit some ban-word filter, but when i pm a mod they tell me either the filter doesnt exist or i should stay away from illegal topics and i'll be fine. nobody ever told me why i get the ban or what word tripped the filter.

ps i confess to no alleged trolling.


I think he's banned for another couple months or something.

The rules as to what is or is not contraband on these boards is laughable. It's like those who have no clue about programming or computing in General were in charge of the rule set.


Like banning autoit discussion because the language can be used to create tools for games. Well....that's any language. The only reason autoit was banned is because you could use it to automate mouse clicks in game. You can do this with many different languages, including c++ and python. But we can't ban the fan favorites now can we? Double standards. This completely insults the language and all the cool non gaming related things that can be done with it.

Mods frequently ban and remove topics about lua scripting in wow. Like really?
Go Back To Programming & Development Topic List
Prev12345610Next
Add Reply New Topic New Poll