Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6871797
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:50:54+00:00 2026-05-27T03:50:54+00:00

I’m trying to write a bot for turntable.fm using alaingilbert’s API (https://github.com/alaingilbert/Turntable-API), which uses

  • 0

I’m trying to write a bot for turntable.fm using alaingilbert’s API (https://github.com/alaingilbert/Turntable-API), which uses node.js. I’ve never written a line of javascript before, so I’m not sure what I’m getting wrong here.

Here’s my code:

var container = document.body;

if(document.getElementById("ttapi")) {
    container.removeChild(document.getElementById("ttapi"));
}
var obj = document.createElement("div");
obj.id = "ttapi";
obj.style.position = "absolute";
obj.style.top = "20px";
obj.style.left = "20px";
obj.style.width = "500px";
obj.style.height = "100px";
obj.style.padding = "10px";
obj.style.backgroundColor = "#fff";
obj.style.fontSize = "13px";
var auth = document.createElement("div");
    auth.innerHTML = "Auth: "+turntable.user.auth;
var userid = document.createElement("div");
    userid.innerHTML = "UserId: "+turntable.user.id;
for (var i in turntable) { if (turntable[i].roomId) { var rid = turntable[i].roomId; break; } }
var roomid = document.createElement("div");
    roomid.innerHTML = "RoomId: "+rid;
var testLine = document.createElement("div");
    testLine.innerHTML = " IM STILL WORKING";

var Bot= require('ttapi');
var AUTH = turntable.user.auth;
var USERID = turntable.user.id;
var ROOMID = rid;   

obj.appendChild(auth);
obj.appendChild(userid);
obj.appendChild(roomid);
obj.appendChild(testLine);
container.appendChild(obj);

I’m running the script from a bookmarklet while on turntable. I’m not really sure how to get good debug messages from javascript, so I’m debugging by moving container.appendChild(obj) down with each line of code. It stops displaying when the script stops working

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T03:50:54+00:00Added an answer on May 27, 2026 at 3:50 am

    It sounds like you’re trying to run node.js code in the browser. If this is correct, then it won’t work because require is a node-specific function. Node.js does not run in a browser; it is an alternative runtime for javascript that things like turntable.fm run on instead of on a browser.

    If you want to write something using a bookmarklet, you will only be able to use what is available through the browser–that is, what you can access when you go to turntable.fm, open the javascript console and start typing things in. This generally consists of window and document, and any libraries that turntable.fm is using. If they’re using the jquery, for example, you can access that with $.

    Edit: Also, if you are using firefox look for the ‘firebug’ extension. If you’re lucky (or use chrome), your browser (or an extension like firebug) will give you console.log which is useful for debugging.

    Oh, and here’s the manual: https://developer.mozilla.org/en-US/docs You’ll want to read it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm making a simple page using Google Maps API 3. My first. One marker
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.