Why does’t !wget -P use the full link?

  python, wget

I am using this code on google colab to save media files from a number of links stored in a text file:

url_file = open('myfile.txt','r')
for url in url_file.readlines():
   !wget -P /content/drive/MyDrive/gadgets Drive/dirUrl {url}
   # Testing if the url is printed correctly
   print (url)

if I give it short links (ex: https://bugs.python.org/file47781/Tutorial_EDIT.pdf) it saves it to my google drive with no problem. However, if the link is of a picture from social media it gives the following error:

Resolving scontent-nrt1-1.cdninstagram.com (scontent-nrt1-1.cdninstagram.com)…, 2a03:2880:f20f:c4:face:b00c:0:43fe
Connecting to scontent-nrt1-1.cdninstagram.com (scontent-nrt1-1.cdninstagram.com)||:443… connected.
HTTP request sent, awaiting response… 403 Forbidden

What it does is that it takes only part of the link given above and discards the rest which is:


note: the print line works fine and gives the full link.
I want to know how can I let the !wget -P take the full link in this case.

I am new here, so excuse me if I made any mistake by not following the regulations correctly.


Source: Python Questions