2

I want to write a bash script that can parse the version number of apps in the android appstore. For example this app, https://play.google.com/store/apps/details?id=com.alphonso.pulse&hl=en

How would I get the value '3.0.6' from the Current Version header on the right hand side of the page?

Chris Seymour
  • 79,902
  • 29
  • 153
  • 193
thisiscrazy4
  • 1,815
  • 8
  • 35
  • 57
  • 1
    Here is the xpath to the `3.0.6`: `//*[@id="details-tab-1"]/div[1]/dl/dd[3]`. You'll need to find a way to parse out the webpage, and [regex is not your friend](http://stackoverflow.com/a/1732454/1529339) with html parsing. – Nick Jan 18 '13 at 21:47
  • What if I wget the page? I could then match this line right? `Current Version:
    3.0.6
    `
    – thisiscrazy4 Jan 18 '13 at 21:50

1 Answers1

5
$ site=https://play.google.com/store/apps/details?id=com.alphonso.pulse

$ curl -s $site | sed -rn 's/.*(Current Version:)[^0-9]*([0-9.]+).*/\1\2/p'
Current Version:3.0.6 

$ curl -s $site | sed -rn 's/.*Current Version:[^0-9]*([0-9.]+).*/\1/p'
3.0.6
Chris Seymour
  • 79,902
  • 29
  • 153
  • 193