[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]
On 27/12/2020 06:18, Jowan wrote:
Thanks for this and thank you also to Peter for his solution. I think there is room for both here, but it also highlights the power of the command line interface.extract the url iscat output1.txt | grep "https://qoto.org/media <https://qoto.org/media>" >> toot.txtgrep 'Text URL: ' toot.txt | sed 's/Text URL: //'
Regards Paul
On Sat, 26 Dec 2020 at 23:04, <peter.walker@xxxxxxxxxxxxxxx <mailto:peter.walker@xxxxxxxxxxxxxxx>> wrote:It would be easy to parse the toot output to give you the url - awk, cut or perl are options. But can't you just use the toot --media option for this? toot --media file.png < text.txt Or am I missing something? Cheers Pete On 26 Dec 2020 22:33, Paul Sutton via list <list@xxxxxxxxxxxxx <mailto:list@xxxxxxxxxxxxx>> wrote: Hi I am experimenting with the command line mastodon client toot If I save some text in for example toot.txt then run toot post < toot.txt The content of toot.txt is posted to Mastodon (as expected) Posting pictures however is a two step process 1. run toot upload file.png will give me the following Successfully uploaded media ID 105448798680946910, type 'image' Original URL: https://storage.gra.cloud.ovh.net/v1/AUTH_011f6e315d3744d498d93f6fa0d9b5ee/qotoorg/media_attachments/files/105/448/798/680/946/910/original/27bd608eb6e11dab.png <https://storage.gra.cloud.ovh.net/v1/AUTH_011f6e315d3744d498d93f6fa0d9b5ee/qotoorg/media_attachments/files/105/448/798/680/946/910/original/27bd608eb6e11dab.png> Preview URL: https://storage.gra.cloud.ovh.net/v1/AUTH_011f6e315d3744d498d93f6fa0d9b5ee/qotoorg/media_attachments/files/105/448/798/680/946/910/small/27bd608eb6e11dab.png <https://storage.gra.cloud.ovh.net/v1/AUTH_011f6e315d3744d498d93f6fa0d9b5ee/qotoorg/media_attachments/files/105/448/798/680/946/910/small/27bd608eb6e11dab.png> Text URL: https://qoto.org/media/nDWr_rzPjQbyxsh6ikA <https://qoto.org/media/nDWr_rzPjQbyxsh6ikA> In general I can manually copy / paste a url from the above to a toot. However doing this from the command line, toot upload file.png > picture.txt which produces a text file containing similar text to the above. Question : How would I for example extract 'just' the url for the picture (e.g the text url line. 'https://qoto.org/media/nDWr_rzPjQbyxsh6ikA <https://qoto.org/media/nDWr_rzPjQbyxsh6ikA>' which will be different each time, but would have 'https://qoto.org/media <https://qoto.org/media>' running cat output1.txt | grep "https://qoto.org/media <https://qoto.org/media>" >> toot.txt appears to keep the "Text URL: " in place but does include the url. Can anyone help please. I am probably 90% of the way there with this. Thanks Paul-- Paul Sutton, Cert ContSci (Open)https://personaljournal.ca/paulsutton/ <https://personaljournal.ca/paulsutton/> LibrePlanet 2021 - March 2021 - https://libreplanet.org/wiki/Main_Page <https://libreplanet.org/wiki/Main_Page>-- The Mailing List for the Devon & Cornwall LUGhttps://mailman.dcglug.org.uk/listinfo/list <https://mailman.dcglug.org.uk/listinfo/list> FAQ: http://www.dcglug.org.uk/listfaq <http://www.dcglug.org.uk/listfaq>-- The Mailing List for the Devon & Cornwall LUGhttps://mailman.dcglug.org.uk/listinfo/list <https://mailman.dcglug.org.uk/listinfo/list> FAQ: http://www.dcglug.org.uk/listfaq <http://www.dcglug.org.uk/listfaq>
-- Paul Sutton, Cert ContSci (Open) https://personaljournal.ca/paulsutton/ LibrePlanet 2021 - March 2021 - https://libreplanet.org/wiki/Main_Page -- The Mailing List for the Devon & Cornwall LUG https://mailman.dcglug.org.uk/listinfo/list FAQ: http://www.dcglug.org.uk/listfaq