Exemplo n.º 1
0
 def __init__(self):
     BaseScraper.__init__(self)
     self.html_scraper = ScrapeTrailPeakRawHTML()
     self.gpx_scraper = ScrapeTrailPeakGPX()
     self.html_scraper.debug = False
     self.base_url = "https://www.trailpeak.com/index.jsp?con=trail&val="
     self.wait = 0
Exemplo n.º 2
0
 def __init__(self, *args, **kwargs):
     
     BaseScraper.__init__(self, *args, **kwargs)
     
     if self.template_url is None:
         raise ValueError("%s must have a template_url attribute" % self.__class__.__name__)
     
     self.request_manager = FastRequestManager()
     response = self.request_manager.make_request(self.template_url)
     self.template_html_schema = self._get_html_schema(response.raw_html)
Exemplo n.º 3
0
    def __init__(self, *args, **kwargs):

        BaseScraper.__init__(self, *args, **kwargs)

        if self.template_url is None:
            raise ValueError("%s must have a template_url attribute" %
                             self.__class__.__name__)

        self.request_manager = FastRequestManager()
        response = self.request_manager.make_request(self.template_url)
        self.template_html_schema = self._get_html_schema(response.raw_html)
    def get_uncached_content(self, url):
        trail_id = url.replace(self.base_url, "")

        html_url = self.base_url+trail_id
        html = self.html_scraper.item_content(html_url)

        for line in html.split("\n"):
            if "GPX_URL" in line:
                name = line.split("\"")[1]
                if name is not "":
                    gpx_url = "https://www.trailpeak.com/content/gpsData/gps{}-{}.gpx".format(trail_id, name)
                    data = BaseScraper.get_uncached_content(self, gpx_url)
                    return data
        return ""
 def __init__(self):
     BaseScraper.__init__(self)
     self.base_url = "https://www.trailpeak.com/index.jsp?con=trail&val="
Exemplo n.º 6
0
 def _validate(self, response):
     
     return BaseScraper._validate(self, response) and self._compare_with_template(response)
Exemplo n.º 7
0
    def _validate(self, response):

        return BaseScraper._validate(
            self, response) and self._compare_with_template(response)