Skip to content

wheeland/cpp-musicscrape

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

About

musicscrape is a small C++ library for scraping Bandcamp and Youtube web pages.

musicscrape by itself doesn't do any HTTP requests, it will just tell you which web page to download, and parse the resulting HTML. Combine with your favorite HTTP library to see some action!

QMusicScrape is a small Qt wrapper that will take care of running the required HTTP requests for you.

musicscrape uses Gumbo for HTTP Parsing and RapidJSON for JSON Parsing.

Dependencies

  • libc
  • C++ STL
  • QMusicScrape: Qt 5.6 or higher

Example

std::string searchUrl = ScrapeBandcamp::searchUrl("cloudkicker");
std::string html = httpGet(searchUrl);  // your favorite HTTP library here!
std::vector<ScrapeBandcamp::Result> searchResults = ScrapeBandcamp::searchResult(html);

for (const ScrapeBandcamp::Result &result : results) {
    if (result.resultType == ScrapeBandcamp::Result::Band) 
        std::cout << result.bandName << std::endl;
    else if (result.resultType == ScrapeBandcamp::Result::Album) {
        std::cout << result.bandName << " " << result.albumName;
    else if (result.resultType == ScrapeBandcamp::Result::Track)
        std::cout << result.bandName << " " << result.albumName << " " << result.trackNum << " " << result.trackName << std::endl;
}

For a full examples, see the files in the test/ directory.

Build

$ git clone https://github.com/wheeland/cpp-musicscrape
$ cd cpp-musicscrape
$ git submodule init        # get Gumbo and RapidJSON

$ cmake -DMUSICSCRAPE_BUILD_QMUSICSCRAPE=[0|1] .
$ make

About

A small C++ library for scraping Bandcamp and Youtube web pages

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors