Wetfish Online
		Discussion Forums => Suggestions & Feedback => Topic started by: nicefish on June 18, 2020, 07:35:45 pm
		
			
			- 
				Upload to https://wiki.wetfish.net/uploader
 Just like https://0x0.st/
- 
				Agreed, this is something I've been wanting for a long time as well
			
- 
				Oh wait I figured it out a while back but forgot about it.
 
 [nicefish@nicepc ~]$ function fish-upload { curl https://wiki.wetfish.net/upload.php -F "Image=@$1"; }
 [nicefish@nicepc ~]$ fish-upload test-image-please-ignore.png
 <meta http-equiv='refresh' content='2;url=upload/3282b878-e65d-e1f5-f20e-9163e27b55a3.png'>Image added!
 It's a bit rough, the output. Someone please improve the function, especially the output.
- 
				Oh wait I figured it out a while back but forgot about it.
 
 [nicefish@nicepc ~]$ function fish-upload { curl https://wiki.wetfish.net/upload.php -F "Image=@$1"; }
 [nicefish@nicepc ~]$ fish-upload test-image-please-ignore.png
 <meta http-equiv='refresh' content='2;url=upload/3282b878-e65d-e1f5-f20e-9163e27b55a3.png'>Image added!
 It's a bit rough, the output. Someone please improve the function, especially the output.
 
 
 You could try using the query parameter "api=true" instead
 
 https://github.com/wetfish/classic/blob/master/wiki/upload.php#L53
- 
				Oh wait I figured it out a while back but forgot about it.
 
 [nicefish@nicepc ~]$ function fish-upload { curl https://wiki.wetfish.net/upload.php -F "Image=@$1"; }
 [nicefish@nicepc ~]$ fish-upload test-image-please-ignore.png
 <meta http-equiv='refresh' content='2;url=upload/3282b878-e65d-e1f5-f20e-9163e27b55a3.png'>Image added!
 It's a bit rough, the output. Someone please improve the function, especially the output.
 
 
 You could try using the query parameter "api=true" instead
 
 https://github.com/wetfish/classic/blob/master/wiki/upload.php#L53
 
 
 Can you make api=true also print the full URL to the file, in addition to giving the header redirect?
- 
				I got it, never mind.
 
 function fish-upload { curl "https://wiki.wetfish.net/upload.php?api=true" -i -F "Image=@$1"| grep -i "^location:" |sed "s/^location: /https:\/\/wiki.wetfish.net/i"; }
- 
				Easy facebook reupload
 [nicefish@nicepc /tmp]$ wget "https://scontent-sjc3-1.xx.fbcdn.net/v/t1.0-9/65451232_2167607030004889_4540696943533228032_n.jpg?_nc_cat=XXX&_nc_sid=XXXXXX&_nc_ohc=XXXXXXXXXXXXXXXX&_nc_ht=scontent-sjc3-1.xx&oh=XXXXXXXXXXXXXXXXXXXXXXx&oe=XXXXXX"
 --2020-06-25 06:38:30--  https://scontent-sjc3-1.xx.fbcdn.net/v/t1.0-9/65451232_2167607030004889_4540696943533228032_n.jpg?_nc_cat=XXX&_nc_sid=XXXXXX&_nc_ohc=XXXXXXXXXXXXXXXX&_nc_ht=scontent-sjc3-1.xx&oh=XXXXXXXXXXXXXXXXXXXXXXx&oe=XXXXXX
 Resolving scontent-sjc3-1.xx.fbcdn.net (scontent-sjc3-1.xx.fbcdn.net)... 2a03:2880:f031:19:face:b00c:0:3, 157.240.22.25
 Connecting to scontent-sjc3-1.xx.fbcdn.net (scontent-sjc3-1.xx.fbcdn.net)|2a03:2880:f031:19:face:b00c:0:3|:443... connected.
 HTTP request sent, awaiting response... 200 OK
 Length: 38346 (37K) [image/jpeg]
 Saving to: ‘65451232_2167607030004889_4540696943533228032_n.jpg?_nc_cat=XXX&_nc_sid=XXXXXX&_nc_ohc=XXXXXXXXXXXXXXXX&_nc_ht=scontent-sjc3-1.xx&oh=XXXXXXXXXXXXXXXXXXXXXXx&oe=XXXXXX’
 
 65451232_21676070 100%[==========>]  37.45K  --.-KB/s    in 0.01s
 
 2020-06-25 06:38:30 (3.79 MB/s) - ‘65451232_2167607030004889_4540696943533228032_n.jpg?_nc_cat=XXX&_nc_sid=XXXXXX&_nc_ohc=XXXXXXXXXXXXXXXX&_nc_ht=scontent-sjc3-1.xx&oh=XXXXXXXXXXXXXXXXXXXXXXx&oe=XXXXXX’ saved [38346/38346]
 
 [nicefish@nicepc /tmp]$ unzuck.py "65451232_2167607030004889_4540696943533228032_n.jpg?_nc_cat=XXX&_nc_sid=XXXXXX&_nc_ohc=XXXXXXXXXXXXXXXX&_nc_ht=scontent-sjc3-1.xx&oh=XXXXXXXXXXXXXXXXXXXXXXx&oe=XXXXXX"
 65451232_2167607030004889_4540696943533228032_n.jpg
 [nicefish@nicepc /tmp]$ fish-upload 65451232_2167607030004889_4540696943533228032_n.jpg
 % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
 Dload  Upload   Total   Spent    Left  Speed
 0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--100 38576    0     0  100 38576      0   167k --:--:-- --:--:-- --:--100 38576    0     0  100 38576      0   162k --:--:-- --:--:-- --:--:--  161k
 https://wiki.wetfish.net/upload/e55e1957-7bd7-5580-7afc-d360f941174f.jpg
 
 
 [nicefish@nicepc /tmp]$ cat ~/bin/unzuck.py
 #!/usr/bin/env python3
 
 from urllib.parse import urlparse
 import sys
 import os.path
 import os
 
 def main():
 fn = urlparse(sys.argv[1], scheme='file').path
 fn = os.path.basename(fn)
 os.rename(sys.argv[1], fn)
 print(fn)
 
 if __name__ == "__main__":
 main()
 
- 
				I streamlined the process.
 
 1. Get a script to run
 
 [nicefish@nicepc /tmp]$ zuck-prefishload.py "https://scontent-sjc3-1.xx.fbcdn.net/v/t1.0-9/104813564_10157811427069234_8953520707973472624_n.jpg?_nc_cat=105&_nc_sid=XXXXXX&_nc_ohc=XXXXXXXXXX_&_nc_ht=scontent-sjc3-1.xx&oh=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&oe=XXXXXX"
 curl "https://scontent-sjc3-1.xx.fbcdn.net/v/t1.0-9/104813564_10157811427069234_8953520707973472624_n.jpg?_nc_cat=105&_nc_sid=XXXXXX&_nc_ohc=XXXXXXXXXX_&_nc_ht=scontent-sjc3-1.xx&oh=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&oe=XXXXXX" -o "104813564_10157811427069234_8953520707973472624_n.jpg"
 # fish-upload 104813564_10157811427069234_8953520707973472624_n.jpg
 
 2. Run the script
 
 [nicefish@nicepc /tmp]$ zuck-prefishload.py "https://scontent-sjc3-1.xx.fbcdn.net/v/t1.0-9/104813564_10157811427069234_8953520707973472624_n.jpg?_nc_cat=105&_nc_sid=XXXXXX&_nc_ohc=XXXXXXXXXX_&_nc_ht=scontent-sjc3-1.xx&oh=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&oe=XXXXXX" |sh
 % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
 Dload  Upload   Total   Spent    Left  Speed
 100 74846  100 74846    0     0   182k      0 --:--:-- --:--:-- --:--:--  182k
 
 3. Paste the fish-upload command provided as a comment from the script
 
 [nicefish@nicepc /tmp]$ fish-upload 104813564_10157811427069234_8953520707973472624_n.jpg
 % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
 Dload  Upload   Total   Spent    Left  Speed
 100 75078    0     0  100 75078      0   894k --:--:-- --:--:-- --:--:--  894k
 https://wiki.wetfish.net/upload/4d7de2fa-42f7-b3c5-1fca-3d696887fbb5.jpg
 
 4. Source
 
 [nicefish@nicepc /tmp]$ cat ~/bin/zuck-prefishload.py
 #!/usr/bin/env python3
 
 import sys
 from urllib.parse import urlparse
 import os.path
 
 def main():
 url = sys.argv[1]
 fn = urlparse(url).path
 fn = os.path.basename(fn)
 print(f'curl "{url}" -o "{fn}"')
 print(f'# fish-upload {fn}')
 
 if __name__ == "__main__":
 main()