tags:

views:

457

answers:

6
+4  Q: 

Guitar Tab API?

Hello everyone,

I was just curious if anyone has heard of any sort of API for guitar tabs? The thought passed through my mind that it would be really neat if I could grab guitar tabs from the internet to bring into my C# app, but haven't been able to find anything.

Thanks, Chris

+2  A: 

You can use System.Net.WebRequest to read the repository of your choice.

You can also use System.ServiceModel.Syndication.SyndicationFeed to read RSS feeds.

EDIT: Try scraping http://www.mxtabs.net/guitar_tabs/ using WebRequest.

You can write code that sends requests to the pages of that (or any other) website and parses the responses to extract information.

However, you might want to get their permission first. They might even offer you an API.

SLaks
+1 to counteract the inexplicable downvote.
MusiGenesis
Thanks.
SLaks
LOL. Every guitar tab site I found has *Stairway to Heaven* as the first-listed tab. C'mon, people, there are *other* guitar songs in the world!
MusiGenesis
I didn't downvote this answer, but I believe that Chrisc is looking for a way to parse the tabs, not get them in the first place.
Jorge Israel Peña
@Blaenk: You may be right; he wasn't very clear.
SLaks
@Blaenk: from Chrisc's comment: "I think my main problem currently is just obtaining the guitar tab data"
MusiGenesis
Yeah the thought of trying to grab something directly from a webpage crossed my mind. I've never done anything like that before though... and, I'm not quite sure how I would get to the correct tab page (e.g. highest rated tab)
Chrisc
A: 

http://www.911tabs.com/ seems to have a large selection, and they appear to all be a variant of ASCII-art, so it would be relatively easy to write an HTML- or text-scraping routine. They don't appear to use a very standardized format, however, so this might be more work than I think.

MusiGenesis
is screen scraping the best .NET solution out there? ummm, no.
Devtron
+1  A: 

To scrape a web page, first figure out exactly which data you want to extract.

Visit the relevant pages with Fiddler running, and look at the HTTP requests and responses that you get.

You can then write C# code that requests the relevant page and reads through the response, line by line, looking for lines that you're interested in.

If the web page is XHTML compliant, you can also parse it using XDocument, but most web pages aren't.

SLaks
+2  A: 

You should approach it from another angle.. Why isn't there a good data format to transfer guitar tab data? I mean, ASCII art is good but it is easily damaged, and it doesn't convery timing information well.

If you could come up with a format that could reach critical mass, that would be a good thing.

Moose
Moose, that is something that I might ponder over in the near future. But, for now, I don't really have the time to invest unfortunately.
Chrisc
^ sounds like you want more than you can offer. I really suggest writing your own web service to display blob fields, its very easy to do, its .NET CLR friendly and you could share it with us on Stackoverflow. Dont be scared, I will help you do it if you want.
Devtron
Devtron, could you point me in the direction of a tutorial or example web service?
Chrisc
A: 

I would suggest writing your own API as a WebService. You would need to find out the legalities of this, since the music itself is copyrighted and un-distributable usually. I would recommend storing them in a SQL database as BLOB fields, like in the example here. Or always look at MSDN, like here.

I would also look into magazines like Guitar World, and contact their editors to see if they can help you. Like here.

I still like the hamster idea best though...

SCREEN SCRAPING WEBSITES IS NOT VERY C#. STAY AWAY FROM HTML HACKS, THIS IS .NET FOLKS.

Devtron
-1 payback. Don't presume to tell me (or anyone, for that matter) what is or is not C#/.Net. And the hamster "idea" isn't even vaguely funny.
MusiGenesis
^ yes, listen to this guy. he writes his websites for IE only. :)
Devtron
@Devtron: You are wrong. There is no reason that website scraping is "not cary C#"; I've done it many times myself in C#. It's actually very easy to do with LINQ-to-XML if the website valid XHTML, and even if it isn't, you can loop a StreamReader in a state machine.
SLaks
However, you have a point about the legalities.
SLaks
A: 

Still haven't found anything good at there as for an API that delivers tablature.