def search_artist(artist_name): query = "intitle:{artist}".format(artist=artist_name) page_titles = [result["title"] for result in site.search(query, what="text")] page_title_map = {title.lower():title for title in page_titles} artist_page, discog_page = filter_search_results(page_title_map, artist_name.lower()) # return get_album_pages(artist_page) discog_info = get_discog_info(artist_page) if discog_info.page: return discog.parse_discog_page(discog_info.page) else: return discog.parse_discog_section(discog_info.section)
import discog import mwsiteext site = mwsiteext.Site() album_page_names = discog.parse_discog_page(site, "The Verve discography") for album_page_name in album_page_names: print album_page_name.encode('utf-8') ''' album_page_names = discog.parse_discog_page(site, "Godsmack discography") for album_page_name in album_page_names: print album_page_name '''
def get_album_pages(artist_page): discog_info = get_discog_info(artist_page) if discog_info.page: return discog.parse_discog_page(discog_info.page) else: return discog.parse_discog_section(discog_info.section)