I’m trying to get the download link of wordpress’ plugins via bash script directly from its official age.
For instance, the akismet plugin at http://wordpress.org/extend/plugins/akismet/
In the HTML source code we can easily recognize where the link for download is:
<div class="col-3">
<p class="button">
<a href='http://downloads.wordpress.org/plugin/akismet.2.5.3.zip'>
Download Version 2.5.3
</a>
</p>
I noticed that the words “Download Version” only appear once in the entire file, just after the download link that we want to get.
Let’s say I do not know what is the download link. The question is how can filter the html code in order to get the download link (so later I can use it with wget or curl). All I know is the plugin page url. How do I filter the html code in order to extract the download link.
Thank you.
Notice the
-oswitch for grep, that makes it output the matched part only instead of the entire line.