determine_image_url by BeautifulSoup #10

Merged
MrClon merged 1 commit from refs/pull/10/head into wip 2023-11-29 00:30:24 +00:00
MrClon commented 2023-11-28 21:21:19 +00:00 (Migrated from codeberg.org)

Rewrote FeedReader.determine_image_url. It return list of src of all tags entry content that match IMAGE_SELECTOR.
Selector can be moved to the config, so user can tune it for their feed. Current hardcoded selector more like demo to show how user can filter out some imgs.
It depend on beautifulsoup4, but (if i understand correctly) we already have beautifulsoup4 as secondary dependence

In my target case this code work just fine with your recent commit

Rewrote `FeedReader.determine_image_url`. It return list of `src` of all tags entry content that match `IMAGE_SELECTOR`. Selector can be moved to the config, so user can tune it for their feed. Current hardcoded selector more like demo to show how user can filter out some imgs. It depend on `beautifulsoup4`, but (if i understand correctly) we already have `beautifulsoup4` as secondary dependence In my target case this code work just fine with [your recent commit](https://codeberg.org/MarvinsMastodonTools/feed2fedi/commit/a65ec43024200e27692b4fd2b6833c23875f056f)
marvin8 commented 2023-11-28 21:43:08 +00:00 (Migrated from codeberg.org)

That looks good. I'll merge a bit later today.

And you are right, beautifulsoup4 was already a secondary dependency. I do think though that all primary dependencies, anything our code has an import ... statement for should be listed in the pyproject.toml file. So thanks for adding bs4 to pyproject.toml

Also, thinking of rewriting the conf file as a toml file. I'll work on that over the next couple of days.

That looks good. I'll merge a bit later today. And you are right, `beautifulsoup4` was already a secondary dependency. I do think though that all primary dependencies, anything our code has an `import ...` statement for should be listed in the `pyproject.toml` file. So thanks for adding bs4 to `pyproject.toml` Also, thinking of rewriting the conf file as a toml file. I'll work on that over the next couple of days.
MrClon commented 2023-11-28 22:54:49 +00:00 (Migrated from codeberg.org)

I do think though that all primary dependencies, anything our code has an import ... statement for should be listed in the pyproject.toml file

Yes, of course. I just said that my PR don't really add new dependence

Also, thinking of rewriting the conf file as a toml file. I'll work on that over the next couple of days.

Do you consider also rewrite Configuration class? Now configuration system requere edit like 4 places to add one option, it frustrating. May be replace it with something like config = ConfigParser().read(config_file_path) and simple template to generate new config file on first launch?

>I do think though that all primary dependencies, anything our code has an import ... statement for should be listed in the pyproject.toml file Yes, of course. I just said that my PR don't really add new dependence >Also, thinking of rewriting the conf file as a toml file. I'll work on that over the next couple of days. Do you consider also rewrite `Configuration` class? Now configuration system requere edit like 4 places to add one option, it frustrating. May be replace it with something like `config = ConfigParser().read(config_file_path)` and simple template to generate new config file on first launch?
marvin8 commented 2023-11-29 00:33:37 +00:00 (Migrated from codeberg.org)

re: dependencies:
Sorry I was just agreeing with you...

re: Configuration Class
I'll see what I can do. Hopefully using tomlkit will allow me to streamline processing.

Anyway, this pull request is now merged into the current wip branch. Thanks again.

re: dependencies: Sorry I was just agreeing with you... re: Configuration Class I'll see what I can do. Hopefully using [tomlkit](https://pypi.org/project/tomlkit/) will allow me to streamline processing. Anyway, this pull request is now merged into the current `wip` branch. Thanks again.
Sign in to join this conversation.
No description provided.