cedricbonhomme / newspipe

A web news aggregator.
https://www.newspipe.org
GNU Affero General Public License v3.0
425 stars 40 forks source link

API available? #44

Closed adulau closed 3 years ago

adulau commented 4 years ago
cedricbonhomme commented 4 years ago

Yes and there is even a "documentation" for it. Just some examples but I call it a documentation ;-)

adulau commented 4 years ago

Cool but I was looking for a way to get the original link of an article from a search. I think it's missing from the API ;-)))

cedricbonhomme commented 4 years ago

It should be something like this:

r = requests.get("https://www.newspipe.org/api/v2.0/articles", headers={'Content-type': 'application/json'}, auth=AUTH, data=json.dumps({'title__contains': 'Python'}))

but I need to check if the controller is using the posted data. I am getting too much results.

There is not only contains: https://github.com/cedricbonhomme/newspipe/blob/master/newspipe/controllers/abstract.py#L40

I will check this tomorrow.

cedricbonhomme commented 4 years ago

it is now working like this:

$ curl -u cedric:password -H "Content-Type: application/json" -d '{"title__contains":"bug"}' -X GET http://127.0.0.1:5000/api/v2.0/articles
[{"content": "<img alt=\"\" src=\"http://powerhose.readthedocs.org/en/latest/_images/medium-powerhose.png\" />\n<div class=\"admonition note\">\n<p class=\"first admonition-title\">Note</p>\n<p class=\"last\">Powerhose turns your CPU-bound tasks into I/O-bound tasks so your Python applications\nare easier to scale.</p>\n</div>\n<p>I've released Powerhose 0.4 at PyPI - <a class=\"reference external\" href=\"http://pypi.python.org/pypi/powerhose/0.4\">http://pypi.python.org/pypi/powerhose/0.4</a>, and this\nnew version has a few changes that are worth speaking of.</p>\n<div class=\"section\" id=\"pyzmq-gevent\">\n<h2>pyzmq + gevent = ?</h2>\n<p>The biggest \u2026</p></div>", "tags": ["python", "mozilla"], "readed": true, "retrieved_date": "2020-03-01T13:23:25.173038", "like": false, "user_id": 2, "id": 325, "feed_id": 23, "updated_date": "2020-03-01T13:23:25.182570", "link": "https://ziade.org/2012/05/25/zmq-and-gevent-debugging-nightmares/", "title": "zmq and gevent debugging nightmares", "entry_id": "tag:ziade.org,2012-05-25:/2012/05/25/zmq-and-gevent-debugging-nightmares/", "category_id": null, "date": "2012-05-25T13:29:00"}, {"content": "<img alt=\"\" src=\"http://powerhose.readthedocs.org/en/latest/_images/medium-powerhose.png\" />\n<div class=\"admonition note\">\n<p class=\"first admonition-title\">Note</p>\n<p class=\"last\">Powerhose turns your CPU-bound tasks into I/O-bound tasks so your Python applications\nare easier to scale.</p>\n</div>\n<p>I've released Powerhose 0.4 at PyPI - <a class=\"reference external\" href=\"http://pypi.python.org/pypi/powerhose/0.4\">http://pypi.python.org/pypi/powerhose/0.4</a>, and this\nnew version has a few changes that are worth speaking of.</p>\n<div class=\"section\" id=\"pyzmq-gevent\">\n<h2>pyzmq + gevent = ?</h2>\n<p>The biggest \u2026</p></div>", "tags": ["mozilla", "python"], "readed": true, "retrieved_date": "2020-03-01T13:23:25.171472", "like": false, "user_id": 2, "id": 326, "feed_id": 23, "updated_date": "2020-03-01T13:23:25.183207", "link": "https://ziade.org/2012/05/25/zmq-and-gevent-debugging-nightmares/", "title": "zmq and gevent debugging nightmares", "entry_id": "tag:ziade.org,2012-05-25:/2012/05/25/zmq-and-gevent-debugging-nightmares/", "category_id": null, "date": "2012-05-25T13:29:00"}, {"content": "<img alt=\"\" src=\"http://powerhose.readthedocs.org/en/latest/_images/medium-powerhose.png\" />\n<div class=\"admonition note\">\n<p class=\"first admonition-title\">Note</p>\n<p class=\"last\">Powerhose turns your CPU-bound tasks into I/O-bound tasks so your Python applications\nare easier to scale.</p>\n</div>\n<p>I've released Powerhose 0.4 at PyPI - <a class=\"reference external\" href=\"http://pypi.python.org/pypi/powerhose/0.4\">http://pypi.python.org/pypi/powerhose/0.4</a>, and this\nnew version has a few changes that are worth speaking of.</p>\n<div class=\"section\" id=\"pyzmq-gevent\">\n<h2>pyzmq + gevent = ?</h2>\n<p>The biggest \u2026</p></div>", "tags": ["python", "mozilla"], "readed": true, "retrieved_date": "2020-03-01T13:23:25.170658", "like": false, "user_id": 2, "id": 324, "feed_id": 23, "updated_date": "2020-03-01T13:23:25.180267", "link": "https://ziade.org/2012/05/25/zmq-and-gevent-debugging-nightmares/", "title": "zmq and gevent debugging nightmares", "entry_id": "tag:ziade.org,2012-05-25:/2012/05/25/zmq-and-gevent-debugging-nightmares/", "category_id": null, "date": "2012-05-25T13:29:00"}, {"content": "<img alt=\"\" src=\"http://powerhose.readthedocs.org/en/latest/_images/medium-powerhose.png\" />\n<div class=\"admonition note\">\n<p class=\"first admonition-title\">Note</p>\n<p class=\"last\">Powerhose turns your CPU-bound tasks into I/O-bound tasks so your Python applications\nare easier to scale.</p>\n</div>\n<p>I've released Powerhose 0.4 at PyPI - <a class=\"reference external\" href=\"http://pypi.python.org/pypi/powerhose/0.4\">http://pypi.python.org/pypi/powerhose/0.4</a>, and this\nnew version has a few changes that are worth speaking of.</p>\n<div class=\"section\" id=\"pyzmq-gevent\">\n<h2>pyzmq + gevent = ?</h2>\n<p>The biggest \u2026</p></div>", "tags": ["mozilla", "python"], "readed": true, "retrieved_date": "2020-03-01T13:23:25.169355", "like": false, "user_id": 2, "id": 323, "feed_id": 23, "updated_date": "2020-03-01T13:23:25.179327", "link": "https://ziade.org/2012/05/25/zmq-and-gevent-debugging-nightmares/", "title": "zmq and gevent debugging nightmares", "entry_id": "tag:ziade.org,2012-05-25:/2012/05/25/zmq-and-gevent-debugging-nightmares/", "category_id": null, "date": "2012-05-25T13:29:00"}, {"content": "<p>I have found out why my entry titles are removed in all planets.\nWordpress recently added in their feeds a new tag in each item of the\nfeed: <br>\n   <media:title type=\"html\">tarek</media:title></p>\n<p>That's the one which get caught in feedparser, instead of the item real\ntitle. This bug was already noticed and added \u2026</p>", "tags": [], "readed": true, "retrieved_date": "2020-03-01T13:23:28.459320", "like": false, "user_id": 2, "id": 1046, "feed_id": 23, "updated_date": "2020-03-01T13:23:28.474692", "link": "https://ziade.org/2008/01/08/planet-and-wordpress-buggy-title/", "title": "Planet and Wordpress buggy title", "entry_id": "tag:ziade.org,2008-01-08:/2008/01/08/planet-and-wordpress-buggy-title/", "category_id": null, "date": "2008-01-08T10:13:00"}, {"content": "<p>I have encoutered really bad bugs in some Python 2.4 applications (Zope\nbased) using the <em>tarfile</em> module. For instance, the\n<em>TarFile.getmembers</em> method that returns the files a tar file contains\nwill just fail to return all files ...   </p>\n<p>Hopefully Zope will work under Python 2.5 sometimes. This is \u2026</p>", "tags": [], "readed": true, "retrieved_date": "2020-03-01T13:23:27.699464", "like": false, "user_id": 2, "id": 938, "feed_id": 23, "updated_date": "2020-03-01T13:23:27.709078", "link": "https://ziade.org/2008/06/19/python-24-tarfile-module-is-buggy-patch-it/", "title": "Python 2.4: tarfile module is buggy, patch it !", "entry_id": "tag:ziade.org,2008-06-19:/2008/06/19/python-24-tarfile-module-is-buggy-patch-it/", "category_id": null, "date": "2008-06-19T00:44:00"}, {"content": "<p>I have found out why my entry titles are removed in all planets.\nWordpress recently added in their feeds a new tag in each item of the\nfeed: <br>\n   <media:title type=\"html\">tarek</media:title></p>\n<p>That's the one which get caught in feedparser, instead of the item real\ntitle. This bug was already noticed and added \u2026</p>", "tags": [], "readed": true, "retrieved_date": "2020-03-01T13:23:28.462326", "like": false, "user_id": 2, "id": 1045, "feed_id": 23, "updated_date": "2020-03-01T13:23:28.472907", "link": "https://ziade.org/2008/01/08/planet-and-wordpress-buggy-title/", "title": "Planet and Wordpress buggy title", "entry_id": "tag:ziade.org,2008-01-08:/2008/01/08/planet-and-wordpress-buggy-title/", "category_id": null, "date": "2008-01-08T10:13:00"}, {"content": "<p>I have encoutered really bad bugs in some Python 2.4 applications (Zope\nbased) using the <em>tarfile</em> module. For instance, the\n<em>TarFile.getmembers</em> method that returns the files a tar file contains\nwill just fail to return all files ...   </p>\n<p>Hopefully Zope will work under Python 2.5 sometimes. This is \u2026</p>", "tags": [], "readed": true, "retrieved_date": "2020-03-01T13:23:27.698982", "like": false, "user_id": 2, "id": 937, "feed_id": 23, "updated_date": "2020-03-01T13:23:27.708129", "link": "https://ziade.org/2008/06/19/python-24-tarfile-module-is-buggy-patch-it/", "title": "Python 2.4: tarfile module is buggy, patch it !", "entry_id": "tag:ziade.org,2008-06-19:/2008/06/19/python-24-tarfile-module-is-buggy-patch-it/", "category_id": null, "date": "2008-06-19T00:44:00"}, {"content": "<p>I have encoutered really bad bugs in some Python 2.4 applications (Zope\nbased) using the <em>tarfile</em> module. For instance, the\n<em>TarFile.getmembers</em> method that returns the files a tar file contains\nwill just fail to return all files ...   </p>\n<p>Hopefully Zope will work under Python 2.5 sometimes. This is \u2026</p>", "tags": [], "readed": true, "retrieved_date": "2020-03-01T13:23:27.699984", "like": false, "user_id": 2, "id": 939, "feed_id": 23, "updated_date": "2020-03-01T13:23:27.709157", "link": "https://ziade.org/2008/06/19/python-24-tarfile-module-is-buggy-patch-it/", "title": "Python 2.4: tarfile module is buggy, patch it !", "entry_id": "tag:ziade.org,2008-06-19:/2008/06/19/python-24-tarfile-module-is-buggy-patch-it/", "category_id": null, "date": "2008-06-19T00:44:00"}, {"content": "<p>I have encoutered really bad bugs in some Python 2.4 applications (Zope\nbased) using the <em>tarfile</em> module. For instance, the\n<em>TarFile.getmembers</em> method that returns the files a tar file contains\nwill just fail to return all files ...   </p>\n<p>Hopefully Zope will work under Python 2.5 sometimes. This is \u2026</p>", "tags": [], "readed": true, "retrieved_date": "2020-03-01T13:23:27.701314", "like": false, "user_id": 2, "id": 940, "feed_id": 23, "updated_date": "2020-03-01T13:23:27.709606", "link": "https://ziade.org/2008/06/19/python-24-tarfile-module-is-buggy-patch-it/", "title": "Python 2.4: tarfile module is buggy, patch it !", "entry_id": "tag:ziade.org,2008-06-19:/2008/06/19/python-24-tarfile-module-is-buggy-patch-it/", "category_id": null, "date": "2008-06-19T00:44:00"}]

with this small change.

you can use contains, in, like and ilike.