2 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
6 """Selects the appropriate scraper for Chrome."""
9 def GetScraper(version
):
10 """Returns the scraper module for the given version.
13 version: version string of Chrome, or None for most recent
16 scrape module for given version
21 parsed_version
= [int(x
) for x
in version
.split(".")]
23 if (parsed_version
[0] > 0 or
24 parsed_version
[1] > 1 or
25 parsed_version
[2] > 97 or
26 parsed_version
[3] > 0):
27 scraper_version
= "chrome011010"
29 scraper_version
= "chrome01970"
31 return __import__(scraper_version
, globals(), locals(), [''])
34 # if invoked rather than imported, test
35 if __name__
== "__main__":
36 print GetScraper("0.1.101.0").version