All Projects → MontFerret → pyfer

MontFerret / pyfer

Licence: Apache-2.0 license
Python wrapper for Ferret

Programming Languages

python
139335 projects - #7 most used programming language
go
31211 projects - #10 most used programming language
c
50402 projects - #5 most used programming language
Makefile
30231 projects

PyFer

This project aims to help you use Ferret using Python.

It's a wrapper around Ferret's C library compiled with CGo.

Installation

pip install pythonferret

Example

You can run embedded fql-script:

from pferret import wrapper

compiler = wrapper.Ferret(cdp='')

query = '''
LET doc = DOCUMENT("https://github.com/topics")

FOR el IN ELEMENTS(doc, ".py-4.border-bottom")
    LIMIT @take
    LET url = ELEMENT(el, "a")
    LET name = ELEMENT(el, ".f3")
    LET description = ELEMENT(el, ".f5")

    RETURN {
        name: TRIM(name.innerText),
        description: TRIM(description.innerText),
        url: "https://github.com" + url.attributes.href
    }
'''

params = {
    "take": 10
}

res = compiler.execute_json(query, params=params)
print(res)

res = compiler.execute(query, params=params)
print(res)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].