address_line_text = station_text_list[ address_line_index ] address_line_text = address_line_text.strip() station_address += address_line_text #-- END loop over remaining address lines (except the first one). --# print( "station_address: " + station_address ) # Now, we actually put the information together and store to # database. # make station description station_description += " - " + station_call_sign + " - " + station_address + "; " + station_city + ", " + station_state + " " + station_zip_code # clean out new lines station_description = StringHelper.clean_string( station_description ) # do we have a URL? if ( ( station_url ) and ( station_url != None ) and ( station_url != "" ) ): # adding to database. print( " ===> adding station: " + station_description ) domain_counter += 1 # domain name cleaned_url = station_url # handle redirect URLS? - first, see if this URL contains "goto=" #redirect_index = cleaned_url.find( URL_FORWARD_STRING ) #if ( redirect_index >= 0 ): # # yes. strip off everything before "goto="
# None - no next element. stop walking. keep_strolling = False #-- END check to see if there is a next element. --# #-- END loop over station elements. --# #print( a_list_bs ) #print( text_list_bs ) # make a string out of the text. station_text = " ".join( text_list_bs ) # clean string - strip out newlines, tabs, and more than one # contiguous space. station_text = StringHelper.clean_string( station_text ) # is this a news station? # Either: # - contains the word "news" # - contains "talk", but not "sport", "christian", or "religious" (I checked the sites that match these by hand, they don't have news). if ( ( NEWS_MATCH.lower() in station_text.lower() ) or ( ( TALK_MATCH.lower() in station_text.lower() ) and ( ( "sport" not in station_text.lower() ) and ( "christian" not in station_text.lower() ) and ( "religious" not in station_text.lower() ) ) ) ): # news! news_station_counter += 1 print( "- NEWS: " + bold_text + " - " + station_text ) # get URL. Got anything in <a> list? if ( len( a_list_bs ) > 0 ):