diff --git a/ncm/start.py b/ncm/start.py index bac71eb..bd15557 100644 --- a/ncm/start.py +++ b/ncm/start.py @@ -9,6 +9,7 @@ from ncm.downloader import get_song_info_by_id from ncm.downloader import download_song_by_id from ncm.downloader import download_song_by_song from ncm.downloader import format_string +from ncm.constants import headers # load the config first config.load_config() @@ -73,7 +74,11 @@ def main(): help='Download a program by program_id') parser.add_argument('-p', metavar='playlist_id', dest='playlist_id', help='Download a playlist all songs by playlist_id') + parser.add_argument('-ua', metavar='user_agent', dest='user_agent', + help='Specify the User-Agent to be used when downloading') args = parser.parse_args() + if args.user_agent: + headers.update({'User-Agent':args.user_agent}) if args.song_id: download_song_by_id(get_parse_id(args.song_id), config.DOWNLOAD_DIR) elif args.song_ids: @@ -91,3 +96,4 @@ def main(): if __name__ == '__main__': main() + \ No newline at end of file