Reputation: 101
Is there any way to copy all the loaded links from the Network Tab in Chrome Dev Tools?
Below is the image for example and I want to copy all the files links? How can I do that at once.
Upvotes: 6
Views: 6932
Reputation: 9475
You can also use a more complex manipulation to print only/filter out some of these entries. For example, this creates an HTML page with all .svg from a har file:
cat myexported.har | jq --raw-output '.log.entries | .[] | select(.response.content.mimeType == "image/svg+xml") | "<img src=\"data:image/svg+xml;base64,\(.response.content.text)\">"' > svgs.html
Upvotes: 0
Reputation: 457
Use the 'Save all as HAR with content' command from the contextual ('right-click') menu in the Network tab of Chrome/Edge/etc. Developer Tools to save it as a .har
file. (For the following example, I named that new file requests.json
.)
Run one of the following from the directory where you saved that file, replacing requests.json
with the filename you used when saving that .har
file (note: these were tested in the bash
shell):
a. View the results:
cat requests.json | jq ".log.entries" | jq --raw-output "[.[] | .request.url] | sort | unique | .[]" | less
b. Save the results to a text file:
cat requests.json | jq ".log.entries" | jq --raw-output "[.[] | .request.url] | sort | unique | .[]" >> sorted-urls-from-requests_$(date +%Y-%m-%d_%H:%M).txt
Delete the file you saved in step 1 when have no more use for it. (it may contain personal information and API keys; depending on the site, it also may be quite large)
--
(Source: my reply to this gist on GitHub)
Upvotes: 1