def build_search_url(search_str, args):
    """Build the search URL with the suplied search string and arguments."""
    base_url = 'https://duckduckgo.com/'
    if args.exact:
        search_str = '"' + search_str + '"'
    if args.site:
        query_string = 'q=site:{} {}'.format(args.site, search_str)
    else:
        query_string = 'q=' + search_str
    if args.no_javascript:
        base_url += 'html/'
    elif args.lite:
        base_url += 'lite/'
    elif args.website_search:
        query_string += '&ia=web'
    elif args.image_search:
        query_string += '&ia=images'
    elif args.video_search:
        query_string += '&ia=videos'
    if args.reg:
        query_string += '&kl=' + args.reg
    if args.duration:
        query_string += '&df=' + args.duration
    return '{}?{}'.format(base_url, query_string)
