Beispiel #1
0
    def __init__(self, parseletfile=None):
        if parseletfile:
            with open(parseletfile) as jsonfp:

                self.parselet = PyParsley(jsonfp)
        else:
            #print "using T1"
            self.parselet = PyParsley(FAP_PARSELET)
Beispiel #2
0
 def parse_parsley(self, response):
     exit()
     parslet = PyParsley(T1, output='python')
     res = UturnItem(T1, parslet.parse(string=response.body))
     pprint.pprint(res)
     print "parsley end"
     return res
Beispiel #3
0
def f(dictionary, ten_range):
    dictionary[1] = '1'
    ten_range.reverse()

    structure = {"title": "/div/div/div"}
    filepath = '/home/ubuntu/Programs/drupal/scrapy-parsley_wrappers/scrapy_parsley/tests/yelp/yelp.html'
    parselet = PyParsley(structure)
    dictionary['sub'] = parselet.parse(file=filepath, output='json')
    dictionary['2'] = 2
    dictionary[0.25] = None
Beispiel #4
0
    def parse(self, response):

        if (self.parselet):
            parselet4 = PyParsley(FAP_PARSELET)

            extract = parselet4.parse(
                file="http://www.imagefap.com/gallery.php", output="python")
            #extract = parselet4.parse(string=config.gallery_php, output = "python")

            #l = GalleryItemLoader(item=GalleryItem, response=response)
            for g in extract["galls"]:
                #self.log("###%s" % g["title"])
                res = GalleryItem(g)
                #res["title"] = g["title"]
                yield res
Beispiel #5
0
 def parse_parsley(self, response):
     parslet = PyParsley(self.parslet_code, output='python')
     return ParsleyItem(self.parslet_code,
                        parslet.parse(string=response.body))