|
| 1 | +# Bright Data CLI |
| 2 | + |
| 3 | +Command-line interface for Bright Data Python SDK. |
| 4 | + |
| 5 | +## Installation |
| 6 | + |
| 7 | +The CLI is automatically installed with the SDK: |
| 8 | + |
| 9 | +```bash |
| 10 | +pip install brightdata-sdk |
| 11 | +``` |
| 12 | + |
| 13 | +## Usage |
| 14 | + |
| 15 | +### Authentication |
| 16 | + |
| 17 | +All commands require an API key. You can provide it in three ways: |
| 18 | + |
| 19 | +1. **Command-line flag** (highest priority): |
| 20 | + ```bash |
| 21 | + brightdata scrape amazon products --api-key YOUR_API_KEY https://amazon.com/dp/... |
| 22 | + ``` |
| 23 | + |
| 24 | +2. **Environment variable**: |
| 25 | + ```bash |
| 26 | + export BRIGHTDATA_API_TOKEN=YOUR_API_KEY |
| 27 | + brightdata scrape amazon products https://amazon.com/dp/... |
| 28 | + ``` |
| 29 | + |
| 30 | +3. **Interactive prompt** (if neither is provided): |
| 31 | + ```bash |
| 32 | + brightdata scrape amazon products https://amazon.com/dp/... |
| 33 | + # Will prompt: Enter your Bright Data API key: |
| 34 | + ``` |
| 35 | + |
| 36 | +### Scrape Commands (URL-based extraction) |
| 37 | + |
| 38 | +#### Generic Scraper |
| 39 | +```bash |
| 40 | +brightdata scrape generic <URL> [--country CODE] [--response-format FORMAT] |
| 41 | +``` |
| 42 | + |
| 43 | +#### Amazon |
| 44 | +```bash |
| 45 | +# Products |
| 46 | +brightdata scrape amazon products <URL> [--timeout SECONDS] |
| 47 | + |
| 48 | +# Reviews |
| 49 | +brightdata scrape amazon reviews <URL> [--past-days DAYS] [--keyword KEYWORD] [--num-reviews NUM] [--timeout SECONDS] |
| 50 | + |
| 51 | +# Sellers |
| 52 | +brightdata scrape amazon sellers <URL> [--timeout SECONDS] |
| 53 | +``` |
| 54 | + |
| 55 | +#### LinkedIn |
| 56 | +```bash |
| 57 | +# Profiles |
| 58 | +brightdata scrape linkedin profiles <URL> [--timeout SECONDS] |
| 59 | + |
| 60 | +# Posts |
| 61 | +brightdata scrape linkedin posts <URL> [--timeout SECONDS] |
| 62 | + |
| 63 | +# Jobs |
| 64 | +brightdata scrape linkedin jobs <URL> [--timeout SECONDS] |
| 65 | + |
| 66 | +# Companies |
| 67 | +brightdata scrape linkedin companies <URL> [--timeout SECONDS] |
| 68 | +``` |
| 69 | + |
| 70 | +#### Facebook |
| 71 | +```bash |
| 72 | +# Posts by profile |
| 73 | +brightdata scrape facebook posts-by-profile <URL> [--num-posts NUM] [--start-date DATE] [--end-date DATE] [--timeout SECONDS] |
| 74 | + |
| 75 | +# Posts by group |
| 76 | +brightdata scrape facebook posts-by-group <URL> [--num-posts NUM] [--start-date DATE] [--end-date DATE] [--timeout SECONDS] |
| 77 | + |
| 78 | +# Posts by URL |
| 79 | +brightdata scrape facebook posts-by-url <URL> [--timeout SECONDS] |
| 80 | + |
| 81 | +# Comments |
| 82 | +brightdata scrape facebook comments <URL> [--num-comments NUM] [--start-date DATE] [--end-date DATE] [--timeout SECONDS] |
| 83 | + |
| 84 | +# Reels |
| 85 | +brightdata scrape facebook reels <URL> [--num-posts NUM] [--start-date DATE] [--end-date DATE] [--timeout SECONDS] |
| 86 | +``` |
| 87 | + |
| 88 | +#### Instagram |
| 89 | +```bash |
| 90 | +# Profiles |
| 91 | +brightdata scrape instagram profiles <URL> [--timeout SECONDS] |
| 92 | + |
| 93 | +# Posts |
| 94 | +brightdata scrape instagram posts <URL> [--timeout SECONDS] |
| 95 | + |
| 96 | +# Comments |
| 97 | +brightdata scrape instagram comments <URL> [--timeout SECONDS] |
| 98 | + |
| 99 | +# Reels |
| 100 | +brightdata scrape instagram reels <URL> [--timeout SECONDS] |
| 101 | +``` |
| 102 | + |
| 103 | +#### ChatGPT |
| 104 | +```bash |
| 105 | +brightdata scrape chatgpt prompt <PROMPT> [--country CODE] [--web-search] [--additional-prompt PROMPT] [--timeout SECONDS] |
| 106 | +``` |
| 107 | + |
| 108 | +### Search Commands (Parameter-based discovery) |
| 109 | + |
| 110 | +#### SERP Services |
| 111 | +```bash |
| 112 | +# Google |
| 113 | +brightdata search google <QUERY> [--location LOCATION] [--language CODE] [--device TYPE] [--num-results NUM] |
| 114 | + |
| 115 | +# Bing |
| 116 | +brightdata search bing <QUERY> [--location LOCATION] [--language CODE] [--num-results NUM] |
| 117 | + |
| 118 | +# Yandex |
| 119 | +brightdata search yandex <QUERY> [--location LOCATION] [--language CODE] [--num-results NUM] |
| 120 | +``` |
| 121 | + |
| 122 | +#### LinkedIn Search |
| 123 | +```bash |
| 124 | +# Posts |
| 125 | +brightdata search linkedin posts <PROFILE_URL> [--start-date DATE] [--end-date DATE] [--timeout SECONDS] |
| 126 | + |
| 127 | +# Profiles |
| 128 | +brightdata search linkedin profiles <FIRST_NAME> [--last-name LAST_NAME] [--timeout SECONDS] |
| 129 | + |
| 130 | +# Jobs |
| 131 | +brightdata search linkedin jobs [--url URL] [--keyword KEYWORD] [--location LOCATION] [--country CODE] [--remote] [--timeout SECONDS] |
| 132 | +``` |
| 133 | + |
| 134 | +#### ChatGPT Search |
| 135 | +```bash |
| 136 | +brightdata search chatgpt prompt <PROMPT> [--country CODE] [--web-search] [--secondary-prompt PROMPT] [--timeout SECONDS] |
| 137 | +``` |
| 138 | + |
| 139 | +#### Instagram Search |
| 140 | +```bash |
| 141 | +# Posts |
| 142 | +brightdata search instagram posts <URL> [--num-posts NUM] [--start-date DATE] [--end-date DATE] [--post-type TYPE] [--timeout SECONDS] |
| 143 | + |
| 144 | +# Reels |
| 145 | +brightdata search instagram reels <URL> [--num-posts NUM] [--start-date DATE] [--end-date DATE] [--timeout SECONDS] |
| 146 | +``` |
| 147 | + |
| 148 | +### Output Options |
| 149 | + |
| 150 | +All commands support output formatting: |
| 151 | + |
| 152 | +```bash |
| 153 | +# JSON format (default) |
| 154 | +brightdata scrape amazon products <URL> --output-format json |
| 155 | + |
| 156 | +# Pretty format (human-readable) |
| 157 | +brightdata scrape amazon products <URL> --output-format pretty |
| 158 | + |
| 159 | +# Minimal format (just the data) |
| 160 | +brightdata scrape amazon products <URL> --output-format minimal |
| 161 | + |
| 162 | +# Save to file |
| 163 | +brightdata scrape amazon products <URL> --output-file results.json |
| 164 | +``` |
| 165 | + |
| 166 | +### Examples |
| 167 | + |
| 168 | +```bash |
| 169 | +# Scrape Amazon product |
| 170 | +brightdata scrape amazon products https://amazon.com/dp/B0123456 --api-key YOUR_KEY |
| 171 | + |
| 172 | +# Search Google |
| 173 | +brightdata search google "python tutorial" --location "United States" --num-results 20 |
| 174 | + |
| 175 | +# Scrape LinkedIn profile |
| 176 | +brightdata scrape linkedin profiles https://linkedin.com/in/johndoe |
| 177 | + |
| 178 | +# Search LinkedIn jobs |
| 179 | +brightdata search linkedin jobs --keyword "python developer" --location "New York" --remote |
| 180 | + |
| 181 | +# Scrape Instagram profile |
| 182 | +brightdata scrape instagram profiles https://instagram.com/username |
| 183 | + |
| 184 | +# Send ChatGPT prompt |
| 185 | +brightdata scrape chatgpt prompt "Explain async programming" --web-search --country us |
| 186 | +``` |
| 187 | + |
| 188 | +## Help |
| 189 | + |
| 190 | +Get help for any command: |
| 191 | + |
| 192 | +```bash |
| 193 | +brightdata --help |
| 194 | +brightdata scrape --help |
| 195 | +brightdata scrape amazon --help |
| 196 | +brightdata search --help |
| 197 | +``` |
| 198 | + |
0 commit comments